473,944 Members | 7,636 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

urgent checkbox help needed pls

3 New Member
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.a sp" id="hobbies" >
<p>
<label for="customerna me">Customer Name: </label><input type="text" id="customernam e" name="customern ame"/><br/>
<label for="customerid ">Customer ID Number: </label><input type="text" id="customerid " name="customeri d"/><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 1611
scripto
143 New Member
since you say quickly, here is the psudo code

sub FixCheckBox()
dim iCounter

for each checkbox in form
if checkbox.checke d 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 New Member
hey thanks. it works.

since you say quickly, here is the psudo code

sub FixCheckBox()
dim iCounter

for each checkbox in form
if checkbox.checke d 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
1819
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 user enters in the text boxes. do i need to group the checkboxes....hwo can i do that??? how to know which checkbox is checked because out of the 15 checkbox say 1,5,7, 9th are checked then i 1st need to get the id from the database adn then
2
5528
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 and subcategory check boxes and click on submit button , I have to retrieve the corresponding categoryid and subcategory id, so that I can store it to a table. I am getting the categoryid but I am failing to get subcategoryid(actually I don't know...
4
1950
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 from the toolbar). System.Windows.Forms.ControlPaint.DrawCheckBox(e.Graphics, tempRectangle, Windows.Forms.ButtonState.Checked) It's draw in a cell within a grid. I use an AddHandler function to call a function (Call it Function X) when the...
7
13646
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 tried with document.form_Name.ListBox_Name.options.selected =
2
1834
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 basically this is what I'm aiming at, its nothing too complicated really. I have a table called RESOURCES which keeps track of all of the stock
3
6494
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 the socket is missing the last character (line feed). When the same text is sent without the urgent flag set, all of the characters are read. I'm reading the data using the blocking read call of the network stream class. The .NET...
2
1210
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 Plain/HTML text into the fields and the HTML will display correctly on the page as if it was written normally in the body of the page, rather than comming from a database field.
0
1101
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 Show/hide button checkbox category 1 <Hide button> <checkbox> car (parent) <checkbox> Maruthi (child) <checkbox> BMW(child)...
0
1675
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 in .NET. I am using an ARCGIS map control which has "Layers" of spatial data (i.e. Roads, Creeks, Rivers, etc.) When I load the form and the map control, I want to create a Dynamic Table of Contents in the form of Check Boxes in order to control...
0
10145
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11545
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11134
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11307
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10673
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
8236
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7397
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4920
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4516
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.