Click to See Complete Forum and Search --> : select combo


yan
06-02-2003, 07:08 PM
Hi all,
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?

I tried this.

document.myform.state.value=rs("state")

It keep showing the first selection on the select list. Help!!!

Thanks

gil davis
06-02-2003, 07:47 PM
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.

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.