I’m trying to clear a text box input from a form as a result of selecting an item from a select box within the same form. I have been able to do this using the onchange event handler. However, in this case the names of the form elements are created on the fly due to not knowing how many records from a database will come up. The names of the forms are created while looping through the records in the database. for example the Name (of the select element) is: (i is the loop control variable)
NAME=”<%= “Visitor2(” & i & “)” %>”
the name of the text input is: NAME=”<%= “Visitor(” & i & “)” %>”
I want Visitor to set the Visitor2(i) element to 0 when the onchange event occurs for the text field (Visitor). I want the text field Visitor to clear when someone selects an item for Visitor2. It works great if the names are not dynamic, but it will not work if the names are built on the fly through the use of a for loop.
Here’s the first part of the Select tag:
<SELECT class=tbFlat NAME=”<%= “Visitor2(” & i & “)” %>” onchange=”form1.Visitor(i).value=’ ‘”SIZE=1>
I’ve also tried changing the onchange to:
onchange=”<%= “form1.Visitor(” & i & “).value=’ ‘”
but that doesn’t work either..
any suggestions?
thanks,
kb