Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Javascript limitations, or maybe not?

Status
Not open for further replies.

Scootman

Programmer
Aug 12, 2003
27
US
Bear with me here please. Yes there's a lot of reading and I know I'm not following the tek-tip tip on how to write a "good question", but pobody's nerfect. Plus I think a good question is where somebody describes everything at once, rather than explaining it in 10 more posts. In other words, I think I took too many Productivity classes in college.
---------------------------------------------------

Right now I can't show my entire code because it has confidential stuff on there which would take too long to remove. Its a contact list for personal use and maybe work use (people, places, websites).

Here's how its setup:

Its a triple box combo with a description area (using div) below the boxes.

First Combo Box: 26 letters
Second Combo Box: 20 categories from each letter
Third Combo Box: 5 choices from each category.

After the math, I'm left with 2600 different results. I know it sounds overkill for a contact list, but hey, I know a lot of people, places, and things.

Here's what the code looks like: This is the 5th option in the third combo box, which itself is from a 4th option of the second combo box.

secondGroup[4][5][0]=new Option(""," ");
secondGroup[4][5][1]=new Option("Click Here","You've clicked there. Congratulations!");

Here's my problem: When I code the script at work, adding options within options, I can only code so much until the IE browser doesn't take anymore. 200 results (out of the 2600 I need), and my browser says "No More!".

The weird thing is that at home, I can (so far) fit in 300 results using the same code and same type of browser (IE) from work. So the score is...Work - 200 results. Home - 300 results.

Question 1: Is there any logical reason why the PC at work doesn't allow more than the PC at work? I'm on an Intranet at work, but the script is client-side at both home and work, so I don't think that should matter. I think either the size of the code (characters) is the issue, or the number of options is. Not sure really though.

Question 2: If I can't get all 2600 choices in one Javascript code (which I'm sure I won't), is there another way I could make this triple combo box work still? I just need a brief idea and I can work from there. And I know Access is an easy option, but I want to stick with html here because of easier availability.

I've searched everywhere for answers and I've found that not many power users like to mention Javascript's limitations. I know, I wish there weren't any limits too, but it appears there are.

Thanks for reading (if you're still awake), and thanks in advance for any help. If you need any extra info, I'll try my best to share it in a much much shorter post. I promise!

Scootman
 

The actual error you're getting would be helpful. I'd bet money that no browser has ever shown an internal message saying "No More!".

Have you tried linking the array data from an external JS file?

Hope this helps,
Dan



[tt]D'ya think I got where I am today because I dress like Peter Pan here?[/tt]

 
Okay, forget the "No more" part of my post above. I neglected to think that would stand out so much in my message.

The one and only helpful thing I did learn from reading a Javascript book is that there are no error messages when your code has no error. There's nothing wrong with the syntax of my code, its just that there's too much of it.

There is just a blank area. Results (or whatever you wanna call them) 199 and 200 show up in the third combo box, but 201 doesn't.

I'm a VB programmer and new to Javascript. So I haven't looked at JS yet. I'll check it out to see if it helps.


Thanks
 

It may well be that the browser you are using (whatever version of IE it is) has a limit to the number of options that can be added into a select element.

Have you considered using a custom-written DHTML solution (scrollable div, etc)? That would have no such limit that I can think of.

Hope this helps,
Dan


[tt]D'ya think I got where I am today because I dress like Peter Pan here?[/tt]

 
If you can run a database and ASP or PHP as a back end on the thing I suggest that you don't even try to code all the options at once. Load them all into a database table and get them as needed from there. Since you apparently have to choose one from the first list first, then one from the second list based on your choice from the first list, etc. that seems like the way to go. If you don't want to reload the entire page, put the second and third lists into iframes and load just the iframe when you need to reload a list. We've used iframes for that and it works really well.


Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Scootman,

There shouldn't be a limit for options anywhere near 200/300 or even 100-fold, 20000. It is the load time that is posting problem. If it is served from the server from your private network, you can code the asp with server side scripttimeout xxx in unit of second. Default of IIS is 90 sec. Make it much bigger for the specific page.
[tt]server.scripttimeout=500[/tt]
for instance.

If it is an html, you have set similarly the metabase default scripttimeout to a bigger number. On the client side, though the size of the page is "big" (<option></option> count already 16 bytes or so), but still manageable for 2600 choices. Even many times bigger is manageable, though not a very good practice, just in thinking about it! But, everyone has their thing to do.

regards - tsuji
 
I got it working. I don't know how, but I added more and it just started working. There weren't any error messages previously. It bugs me that I didn't know what was wrong, but oh well.

Tracy, thanks for the tip about database and, and iframes too. I like PHP, but have had problems with it in the past. Now I just need to find the book "ASP for Dummies" or the "ASP Bible", though I've heard that's a big book on snakes.

tsuji, thanks also for answering a question I couldn't ever find.

Yes, I don't want to have a page of 2600 options (and 2600 tables!!!), so I will be going for a database feel. I've had my own .com website for 5 years now, and this is the first time I've really gotten into advanced html...sad really.

Thanks all. Case closed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top