[thelist] NN4/JS Select Box Value Referencing

Bill Haenel bill at ncpr.org
Tue Oct 22 13:26:02 CDT 2002


I bumped into a weird thing yesterday I haven't encountered before: I had a
function in JavaScript to validate a form, something like validate), where f
if the form passed to the function in an onSubmit event as follows:
onSubmit="validate(this);". IE and NN6+ had no trouble when I tried (inside
the function) to reference the selected value of a select box using:

f.fieldname.value

but NN4 just wouldn't use that reference. For NN4, I had to use:

f.fieldname.options[f.fieldname.selectedIndex].value

For text fields NN4 had no problem with f.fieldname.value, which is how I
eventually managed to troubleshoot the problem. But it just didn't handle
select boxes the same way.

Does this sound normal? Was I wrong in my original attempt? Is it actually
correct the way I ended up doing it? Does NN4 not understand the value
property of a select box without first referencing the options property?

Thanks,

BH




More information about the thelist mailing list