Gossamer Forum
Home : Products : DBMan SQL : Discussion :

Re: [webmaster33] How to create select field?

Quote Reply
Re: [webmaster33] How to create select field? In reply to
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.

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>
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.
Subject Author Views Date
Thread How to create select field? webmaster33 5156 Apr 29, 2005, 4:17 PM
Thread Re: [webmaster33] How to create select field?
jai 5059 Apr 30, 2005, 3:54 AM
Thread Re: [jai] How to create select field?
webmaster33 5060 Apr 30, 2005, 11:14 AM
Thread Re: [webmaster33] How to create select field?
604 5094 May 2, 2005, 9:28 AM
Post Re: [TheStone] How to create select field?
webmaster33 5053 May 2, 2005, 9:37 AM
Thread Re: [TheStone] How to create select field?
webmaster33 5057 May 2, 2005, 3:49 PM
Thread Re: [webmaster33] How to create select field?
604 5059 May 2, 2005, 3:51 PM
Post Re: [TheStone] How to create select field?
webmaster33 5041 May 3, 2005, 4:04 AM
Post Re: [TheStone] How to create select field?
webmaster33 5021 May 4, 2005, 8:33 PM