Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 27th, 2006, 05:07 PM
Authorized User
 
Join Date: Mar 2005
Location: arima, West Indies, Trinidad and Tobago.
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to arimakidd
Default Passing Multiple Checkbox Values

How do I check for multiple 'checked' checkbox values? For instance, I have a form with 5 checkbox options. Suppose the user only checked 3. How do I check how many boxes were chekcked and then of course get the value of each check box?

Reply With Quote
  #2 (permalink)  
Old May 28th, 2006, 03:05 AM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

;;;How do I check how many boxes were checked and then of course get the value of each check box?
Do you need the number of checked boxes in addition to each of thier values?
Do you need to ensure a certain number of boxes are checked before the form can be posted?

Getting the values is the same as any other form elements, using:
request.form("chqBoxName")
on the page the form is being posted to.

Two common ways:
1..Name all the checkboxes the same. The value(s) of each checkbox(s) that have been checked get posted as one commer delimited string.

2..Name them uniquely. Address each named checkboxes seperatley as required.

Wind is your friend
Matt
Reply With Quote
  #3 (permalink)  
Old May 28th, 2006, 08:20 AM
Authorized User
 
Join Date: Jun 2003
Location: Richmond, VA, USA.
Posts: 79
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to erobb Send a message via Yahoo to erobb
Default

<form name="form1" method="post" action="page.asp">
    <input type="checkbox" name="checkbox" value="1">
    <input type="checkbox" name="checkbox" value="2">
    <input type="checkbox" name="checkbox" value="3">
</form>

--Page.asp--
chkCnt=request.form("checkbox").count
response.write "Number of boxes checked: "&chkCnt&"<BR>"
i=1
if chkCnt > 0 then
  do while i <=chkCnt
    response.write request.form("checkbox")(i) & "check value<BR>"
  i=i+1
  loop
end if

Earl
www.jhdesigninc.com
Reply With Quote
  #4 (permalink)  
Old May 28th, 2006, 10:44 AM
Authorized User
 
Join Date: Mar 2005
Location: arima, West Indies, Trinidad and Tobago.
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to arimakidd
Default

Excellent. Great!. This works. Thanks.

Reply With Quote
  #5 (permalink)  
Old October 19th, 2007, 10:25 AM
Registered User
 
Join Date: Oct 2007
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I know this is an older post, however, I am looking to do something very simular, but how can I pass multiple values like the exammple below to another .asp page to do the work?

imryn
Reply With Quote
  #6 (permalink)  
Old October 19th, 2007, 10:28 AM
Registered User
 
Join Date: Oct 2007
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I know this is an older post, however, I am looking to do something very simular, but how can I pass multiple values like the example below to another .asp page to do the work?

imryn
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing multiple values to JSp suhasdoke Servlets 1 April 16th, 2007 11:31 PM
insert multiple checkbox values in to database muthumari_p2003@yahoo.com Pro JSP 0 March 29th, 2006 08:23 AM
passing values from multiple list box tulincim Javascript 4 September 14th, 2005 02:02 AM



All times are GMT -4. The time now is 05:26 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.