View Full Version : Dynamic <select> form fields - IE sudden crash

08-18-2007, 01:46 PM
I have a page with 3 form fields, call them A, B, and C. When a selection is made in A (onchange) JS will build B and C lists. When B (onchange) creates C list. When script starts it creates A, then B, then C.

Works fine in FF. And seems to work ok in IE7 at first, but unstable? After changing selections a few times the IE suddenly crashes. No error appears. Just sudden program closure.

Can someone give me some hints on what can be causing this, what to look for? I am gonna reprogram now, but don't want to do a lot of work to discover same error. Perhaps I am missing some understanding.

08-18-2007, 02:38 PM
Probably an open loop or other memory bug causing the program to overload.

If you post the code, someone can probably find the troublesome part.

08-18-2007, 02:40 PM
It would be very hard to say without seeing your code, and if as you say, there is no error message, even then it could be a bit hard to tell, but we will give it a shot if you give us a link to the problem page.

Please post a link to the page on your site that contains the problematic script so we can check it out.

08-18-2007, 08:51 PM
Just emailed you guys. Would much prefer to discuss online and share the code privately. Hope you understand. I am much appreciative of this dynamic drive!

THANKS for responding. Hope we can find the bug. email me at ancraig a@t hotmail d.o.t com .

08-19-2007, 01:59 AM
I got your email. I will have a look at the links later. For now I want to mention that using tables isn't always bad. Tables are for tabular data. If you have a form where folks need to enter data in a columnar form, tables are what you should use.

Oh, and I'd like to add that sending the links in email is fine. I can certainly understand anyone who would prefer not to have search engines find the forum here when folks are looking for your page and other issues like privacy, etc.

08-19-2007, 03:15 AM
OK, now I have looked at the two links. I like the concept! To save time though, what should I click on and/or fill out to observe the problem? If more than one set of actions is required to see the problem, how many?

08-19-2007, 03:32 AM
If you change country to canada, then play with locality, then change country to USA, then change locality, then change to canada .... like that it'll kill IE.

Am thinking perhaps it has to do with the way I seperated USA locations from rest of work (cause the list gets too long). Is it possible IE is expecting some variable and when it doesn't see the variable it crashes? Thought that's why errors occur, not sudden crash.

Sent you a bunch of code to review. Thanks! Will discuss things if you are confused with some of it. That back and forth discussion might even elucidate the issue.

FYI, I am gonna rewrite this whole thing. Have restructed my data into associative arrays and will address the situation differently. But don't want to move forward without understanding my F-up in existing code.

08-20-2007, 07:17 AM
Have rewritten my code and still the problem exists.

Am thinking it might be something to do with the way I delete all select options, then redefine them dynamically. Could be something to do with an option being selected (of IE thinking it is selected) but then I delete it and it doesn't exist which confuses IE so it crashes? Did a google search and found this:


It seems close enough to be high on likely connection.

My situation is that options in list B "child" are dependent on selected option is list A "parent".

I will try to rewrite my code this way: when a "child" select list is to be modifiied dynamically I will first programatically select the 0 element (first in list) and not delete that element (the 0th element). Then will delete all other elements. Then will redefine first element (0th element) & create all other elements appropriate to the "parent" selection.

Fingers crossed!