Hi,
I'm not sure that I understand what you are trying to do but I use the following code for 2 reasons -
1/ My test field is a required field (NOT NULL) so if the user doesn't select from the list it will generate an error because the option value for "Please select a value" is set at "".
2/ If another required field on the form is not entered and the form is re-loaded my test field will be set to what the user has just selected so they don't have to re-select everything again.
<%if test%>
<option value="<%test%>" selected><%test%></option>
<%else%>
<option value="" selected>Please select a value</option>
<%endif%>
<option value="(1) value1">(1) value1</option>
<option value="(2) value2">(2) value2</option>
<option value="(3) value3">(3) value3</option>
<option value="(4) value4">(4) value4</option>
</select>As I said, I'm not sure what you are trying to do but maybe you can modify my code to do what you want. If not please try to explain it a bit more.
Simon.
I'm not sure that I understand what you are trying to do but I use the following code for 2 reasons -
1/ My test field is a required field (NOT NULL) so if the user doesn't select from the list it will generate an error because the option value for "Please select a value" is set at "".
2/ If another required field on the form is not entered and the form is re-loaded my test field will be set to what the user has just selected so they don't have to re-select everything again.
Code:
<select name="test"> <%if test%>
<option value="<%test%>" selected><%test%></option>
<%else%>
<option value="" selected>Please select a value</option>
<%endif%>
<option value="(1) value1">(1) value1</option>
<option value="(2) value2">(2) value2</option>
<option value="(3) value3">(3) value3</option>
<option value="(4) value4">(4) value4</option>
</select>
Simon.