Solved

VBScript radio button validation

Posted on 2001-06-05
3
2,388 Views
Last Modified: 2008-02-01
Hi all,

I have a group of radio buttons. How do I check whether any of those radio buttons is not checked. The validation have to be done using VBscript.

Thanks in advance.
0
Comment
Question by:choroque
3 Comments
 
LVL 2

Accepted Solution

by:
kmv earned 50 total points
ID: 6158838
Is it server-side checking or client-side?
Server-side.
When you submit form to server all its parameters are sent to script.
If user didn't check any radio button you get empty value of parameter with same name as your radio button name.

E.g.
HTML:

<input type="radio" name="gender" value="male">Male
<input type="radio" name="gender" value="female">Female


Server script:
<%if request.Form("gender")="" then
'place your code here
end if
%>

or
<%if isEmpty(request.Form("gender")) then
'place your code here
end if
%>
0
 
LVL 7

Expert Comment

by:weesiong
ID: 6158958
choroque,

if you have 10 radio button,

Name all radio button same name, but different value

Sample:

<input type="checkbox" name="C1" value="ON1">
<input type="checkbox" name="C1" value="ON2">
<input type="checkbox" name="C1" value="ON3">

asp script:
i = 1
For Each Item in Request.Form("C1")
   IF Item.Value = "" Then Response.Write("C1.value = On" &i&" is no checked")
   i = i + 1
Next

Regards,
Wee Siong
0
 
LVL 1

Author Comment

by:choroque
ID: 6162066
Oppss... I guess I forgot to mention, the validation have to be a client-side script..
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

28 Experts available now in Live!

Get 1:1 Help Now