Solved

VBScript radio button validation

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

813 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

13 Experts available now in Live!

Get 1:1 Help Now