473,386 Members | 1,708 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

urgent checkbox help needed pls

3
hi, does anyone know how to make sure at least one checkbox is checked but no more than three are checked? i need to use vbscript in asp. this is my form:

<html>
<head>
<title>Task 5</title>
</head>
<body>
<h1>Hobby Selection Page<br /></h1>
<form method="post" action="task5.asp" id="hobbies" >
<p>
<label for="customername">Customer Name: </label><input type="text" id="customername" name="customername"/><br/>
<label for="customerid">Customer ID Number: </label><input type="text" id="customerid" name="customerid"/><br/>
</p>
<h3>Please select between 1 and 3 hobbies from the list below:</h3>
<p><input type="checkbox" name="hobbies" value="stamp" />Stamp Collecting <br/>
<input type="checkbox" name="hobbies" value="movies" />Movies <br/>
<input type="checkbox" name="hobbies" value="golf" />Golf <br/>
<input type="checkbox" name="hobbies" value="bush" />Bush Walking <br/>
<input type="checkbox" name="hobbies" value="read" />Reading <br/>
<input type="checkbox" name="hobbies" value="music" />Music <br/>
<input type="checkbox" name="hobbies" value="other" />Other &nbsp;<input type="text" name="other" /><br/>
<br/>
<input type="submit" value="Submit Form"/>
<input type="reset" value="Clear Form" />
</p>
</form>
</body>
</html>

need help really quick pls.
thanks.
Oct 19 '06 #1
2 1593
scripto
143 100+
since you say quickly, here is the psudo code

sub FixCheckBox()
dim iCounter

for each checkbox in form
if checkbox.checked then
iCounter = iCounter + 1
end if
next

if iCounter < 1 then
msgbox "you must select at least one hobby"
return
elseif iCounter > 3 then
msgbox "you can only select 3 hobbies"
return
else
'ok
end if

end sub

place FixCheckBox() in the onclick event for each checkbox.

good luck
Oct 19 '06 #2
Spad2
3
hey thanks. it works.

since you say quickly, here is the psudo code

sub FixCheckBox()
dim iCounter

for each checkbox in form
if checkbox.checked then
iCounter = iCounter + 1
end if
next

if iCounter < 1 then
msgbox "you must select at least one hobby"
return
elseif iCounter > 3 then
msgbox "you can only select 3 hobbies"
return
else
'ok
end if

end sub

place FixCheckBox() in the onclick event for each checkbox.

good luck
Oct 21 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: VbUser25 | last post by:
hi i need urgent responses.. i have some 15 checkboxex on a form... i want to 1st check the no. of checkboxes that are checked?? and then loop it that many times adn insert the quantities the...
2
by: Ceema M via DotNetMonster.com | last post by:
Hello all, I have a nested repeater, which displays categories(parent repeater) and corresponding subcategories(child repeater). Both repeaters have checkboxes. When I check category checkbox...
4
by: Joe Kasta | last post by:
Here's a tricky question..:) I have a a function in a webform that will draw a checkbox in a given area (note, this is an override of a PaintForeground function, not a drop / drag of a checkbox...
7
by: deepagulati | last post by:
Hi, I need an urgent help from you. When we dynamically genrate any list box (Select Box) it shows one default value as selected. Is there any way that we can deselect that value. I...
2
by: Xeijin | last post by:
URGENT I have an assignment to hand in tomorrow, I need to know how to perform numeric calculations in access, I dont know very much about databases so consider this a beginner's query! Well...
3
by: N. Spiker | last post by:
I am attempting to receive a single TCP packet with some text ending with carriage return and line feed characters. When the text is send and the packet has the urgent flag set, the text read from...
2
by: David | last post by:
Hi, I have an asp page for a product which has a tabbed section on it. Each of the tabbed sections displays different data for the product - 1 database field under each tab. I can write...
0
by: yogarajan | last post by:
Hi all, I need to display two sets of records. The second one should come under the first set of records and also second one uses the first one's unique id. for example, First table values id ...
0
by: Nolanclark | last post by:
Hi there. I've read a previous thread regarding the Old VB 6 checkbox array and how it's not really needed any more. That's fine, but I'm not really sure how to implement the checkbox control array...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.