If Statements

hey i have a dynamic list/menu box with a list of states i also have created an option at the front so it's blank at the start

i was wondering what an if statement would be to make it so they have to select something!

i have something like

<cfif Len(Trim(form.MemberPostCode)) LT 4>
<p>ERROR! Post Code must have 4 digits!</p>
<a href="javascript:history.back()">Back</a>
<cfabort>
</cfif>

for just a text form field....but can't seem to protect list/menu's

any help would be great

thanks

Duck Miester
 
This should work.

<select name="states">
<option value="" selected></option>
<option value="State01">State01</option>
<option value="State02">State02</option>
<option value="State03">State03</option>
<option value="State04">State04</option>
</select>

<cfif form.states EQ "">
<p>ERROR! Please select a state!!!</p>
<a href="javascript:history.back()">Back</a>
<cfabort>
</cfif>
 
Back
Top