select combo

admin

Administrator
Staff member
Hi all,<br />
In my address form, I have a select combo for State. How do I assign a value (the client's state) to a select combo?<br />
<br />
I tried this.<br />
<br />
document.myform.state.value=rs("state")<br />
<br />
It keep showing the first selection on the select list. Help!!!<br />
<br />
Thanks<!--content-->The SELECT object does not have a value parameter. It has a selectedIndex which indicates which OPTION is selected (unless the SELECT object is set to MULTIPLE). The OPTION is what has a value parameter.<br />
<br />
Assuming your form is named "myform" and the select box is named "state", the options create an array that is indexed using integers:document.myform.state.options[n].value = rs("state");where "n" is the desired option - although I cannot imagine why you would want to do something like that. Usually the user chooses the state from the select box, not the programmer.<!--content-->
 
Back
Top