Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Radio button validation

Status
Not open for further replies.

ahksar

Programmer
Jan 11, 2001
43
US
Hi,
When I try to submit a form with radio buttons, and none of them are selected, I get an error when I try to insert it into the DB. I want to allow my users the option of not selecting a radio button, and to insert a default value if so.
Can i use something like this in the INSERT page?
<cfif NOT IsDefined(&quot;#form.strStrike#&quot;)>
<cfset &quot;#form.strStrike#&quot;=-9>
</cfif>
strStrike is the name of the radio button.
and the rest of the SQL insert statements follow here...
Thanks
ahksar

 
<cfif Not IsDefined(&quot;form.strStrike&quot;)>
<cfset somevar = -9>
<cfelse>
<cfset somevar = #form.strStrike#>
</cfif>


OR...................


<cfparam name=&quot;form.strStrike&quot; default = &quot;-9&quot;>
 
Thanks a lot..both the solutions worked.
ahksar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top