IShiva
asked on
Dropdown box validation in Coldfusion
This is probably an easy question for you guys but I'm drawing a blank. I have a form that users submit to me. A couple of the fields are dropdown boxes. eg. The title of the field is Select Your Sport and in the dropdown box is a list of sports. Now i have a javascript that checks to see if different fields are filled in within my form but the dropdowns are where i have my problem. Currently the highlighted selection is "Select Your Sport". If a user fills in all required information but forgets to select their sport, i get an email with the info they submitted but in the sport field it says their sport is "Select Your Sport" and not soccer, football, baseball etc.. How can I make the Select your Sport option visible but validate it somehow so that if no sport is selected they will get a message saying "You must select your sport". Does this make sense? I am using <cfform> and have posted my <cfselect> code below.
<cfselect name="sport" message="You must choose a sport to process an update!" required="yes" multiple="no">
<option selected>Select Your Sport</option>
<option value="Football">Football< /option>
<option value="Boys Soccer">Boys Soccer</option>
<option value="Girls Soccer">Girls Soccer</option>
<option value="Field Hockey">Field Hockey</option>
<option value="Girls Volleyball">Girls Volleyball</option>
<option value="Girls Tennis">Girls Tennis</option>
<option value="Boys Cross Country">Boys Cross Country</option>
<option value="Girls Cross Country">Girls Cross Country</option>
<option value="Boys Golf">Boys Golf</option>
</cfselect>
<cfselect name="sport" message="You must choose a sport to process an update!" required="yes" multiple="no">
<option selected>Select Your Sport</option>
<option value="Football">Football<
<option value="Boys Soccer">Boys Soccer</option>
<option value="Girls Soccer">Girls Soccer</option>
<option value="Field Hockey">Field Hockey</option>
<option value="Girls Volleyball">Girls Volleyball</option>
<option value="Girls Tennis">Girls Tennis</option>
<option value="Boys Cross Country">Boys Cross Country</option>
<option value="Girls Cross Country">Girls Cross Country</option>
<option value="Boys Golf">Boys Golf</option>
</cfselect>
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
IShiva