[thelist] more javascript problems - help!!!

Jonathan Chard jonathan at familygenetix.com
Mon Feb 12 06:47:29 CST 2001


Hi again Fintan!

>Everythings fine, except for this; in IE 4.x and NN4 I get the following
error:
Sorry, bad news, I get the problem with IE5 on NT too...

>3. Try to click on the same name again, on the left. I get a
>"document.choiceForm.Students.options>[....] is null or not an object"
error.

When you click on the same name again, you don't add the name to the list
box. (isNew is false).

The line :
document.choiceForm.Students.options[boxLength].selected = true;

Relies on the fact that you've added the name to Students, so you can select
it. So, the short term solution (to get you through the demo!) is to move
the above line into the if (isNew) block, because you only want to select it
if you've added something to the list box.

In the long term, however, I recommend you use a function to submit the
form. Change the submit button to just a normal button, and have it call
this function. In the function, select all the elements in the Students list
box, before calling choiceForm.submit()

That way if people click on the right hand box and muck up your selection,
it won't matter because you'll select them all again just before you submit
it.

Does that make sense? Hope I explained clearly. If not, you know where to
come...

Jon Chard.





More information about the thelist mailing list