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 strongm 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 in ASP

Status
Not open for further replies.

hojoho

Technical User
Mar 8, 2003
44
US
I need to know how to check if a user has selected a radio button or not. I also need to check a group of check boxes to see how many, if any, the user has checked. I have a basic idea for this but it is not in code. I can do this on the client side, but I need it on the server side. It seems as though everyone gives examples of how to do this on the client side which is pretty easy.
Thanks
 
Nice to validate things before sending them to the server but here is an example of how to validate a radio control (R1) and two checkboxes (C1 and C2) from an Active SERVER Page / on the server side.


<%
Dim optBox
Dim chkBox1
Dim chkBox2
'How to get the values
optBox = Request.Form(&quot;R1&quot;)
chkBox1 = Request.Form(&quot;C1&quot;)
chkBox2 = Request.Form(&quot;C2&quot;)

response.write(optbox & &quot; &quot; & chkBox1 & &quot; &quot; & chkBox2)

'How to perform logical test on the values
If optbox = &quot;&quot; then
optBox = &quot;Not Checked&quot;
End IF
If chkBox1 <> &quot;ON&quot; then
chkBox1 = &quot;OFF&quot;
End If
If chkBox2 <> &quot;ON&quot; then
chkBox2 = &quot;OFF&quot;
End IF

response.write(optbox & &quot; &quot; & chkBox1 & &quot; &quot; & chkBox2)

%>

Hope I understood your question ?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top