[thelist] more javascript problems - help!!!

Jonathan Chard jonathan at familygenetix.com
Tue Feb 13 09:02:16 CST 2001


>instead of using the submit() method, may i please suggest that you use the
>onSubmit event handler of the form tag to execute this desired
functionality
>and return true if it's successful.  the reason is that the use of the
>submit() method can render forms completely impotent to non-js users and is
>in nearly every case i've encountered completely unnecessary.

Your response makes me think that I'm missing something fundamental in my
understanding of JavaScript, jeff.

Fintan's problem was with multi select list boxes not passing their selected
values correctly in a form. In IE, it seems that you have to select the
values in the listbox to get them submitted.

Also on his page, he had two list boxes; clicking on one moved names to the
other, so the entire content of the 'target' listbox had to be submitted.

Therefore, in order to make sure that this happens, it's necessary to go
through and select each element in the list box.

Is that wrong?

Secondly, if I'm right and you do need to select all the elements in the
listbox, do you mean that you can put the following in the onsubmit()
routine?

onSubmit="for (var
i=0;i<document.forms.Students.length;i++)document.forms.Students.options[i].
selected=true;return true;"

Will that work, even if js is disabled...? If it does... well, I didn't know
that.

I'm not sure if this discussion is appropriate (in this case) anyhow as
there was a lot of JavaScript on the page, and if it was turned off, you
wouldn't be able to subscribe students to courses anyway.

Perhaps the real solution in this case is to use <NOSCRIPT> tags and give a
horrid longwinded version of the page that uses checkboxes or something
instead of the multi select list boxes.

What do you think?

Jon.
(Hope Fintan doesn't mind us making lots of work for him! He'll probably
write back now and say that it's on an intranet and he doesn't care!)





More information about the thelist mailing list