hi,
I have a select box (drop down) on a form and i need it to automatically default to the selected option that matches a value in a textbox (hidden) on the same page.
i've tried using the following, but nothing happens, i don't even get any error messages.
any idea where i'm going wrong?
for info:
The hidden text box is called hide_5
and the select is called q_5
I have a select box (drop down) on a form and i need it to automatically default to the selected option that matches a value in a textbox (hidden) on the same page.
i've tried using the following, but nothing happens, i don't even get any error messages.
any idea where i'm going wrong?
for info:
The hidden text box is called hide_5
and the select is called q_5
Code:
<script language="vbscript">
For n = 0 to document.frmspa.q_5.options.length - 1
If document.frmspa.q_5.options[n].text = document.frmspa.hide_5.value Then
document.frmspa.q_5.selectedIndex = n
Exit For
End If
Next
</script>