Click to See Complete Forum and Search --> : unexpected error


zonome
03-20-2003, 08:28 AM
I am trying to display the values that the users select from a drop down list....this is the code...

<form name="formName">
<select name="mySelect" onChange='alert(mySelect.options[selectedIndex].value)'>
<option value=UK>UK</option>
<option value=ITA>Italy</option>
......
.......
</select>

but Every time I run it I get the

mySelect.options is null or not an object

error message.

What else do I need to do?

dabush
03-20-2003, 09:17 AM
change 2nd line

<select name=mySelect onChange="alert(window.document.formName.mySelect.options[selectedIndex].value);">

zonome
03-20-2003, 09:18 AM
Thanks

dabush
03-20-2003, 09:29 AM
no problem. just remember, when you want to call a form element

window.document.formname.elementname

zonome
03-20-2003, 09:32 AM
I have another question..

I am trying to pass the selected value from the drop down list to a JSP script like below...

function selectCurrency(bookName){
document.myForm.action = "MyJsp.jsp?" + bookName;
}

Have you had any experience of doing this?

dabush
03-20-2003, 09:35 AM
no, im not sure about how 2 do that.