Solved

VBScript radio button validation

Posted on 2001-06-05
3
2,405 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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
CDO.Message not able to send attachement 5 32
FileUp - Classic ASP 5 20
JQuery Autocomplete Tag AJAX (Need nice script) 11 35
Time comparison asp 1 14
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
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/…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

829 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