Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checkboxes and ASP

Status
Not open for further replies.

smellykat

Programmer
Mar 4, 2002
33
US
I have a table with 2 columns: Vendor Name(display only), Transactions(checkboxes). The amount of checkboxes and their values vary depending on who the vendor is.
For example:
Vendor A name=checkbox value X
name=checkbox value Y
Vendor B name=checkbox value X
name=checkbox value Y
name=checkbox value Z

What i need to do when the NEXT button is clicked from that page is update my database according to the checkboxes selected. The problem is that the value in 'checkbox' is a comma-delimited list of all the ones checked, regardless of which vendor it is. So i would get X,X,Z...How do I know what vendor it goes for?? How can I read the value in the checkboxes correctly?
I am using ASP and Javascript.

Thanks.
 
You need to set the name to something specific for each vendor. Something like this:
Code:
Vendor A:
<INPUT type=checkbox name=VendorA value=X>Item 1
<INPUT type=checkbox name=VendorA value=Y>Item 2
Vendor B:
<INPUT type=checkbox name=VendorB value=X>Item 1
<INPUT type=checkbox name=VendorB value=Y>Item 2
<INPUT type=checkbox name=VendorB value=Z>Item 3

This will give you two different Requests: VendorA=X and VendorB=X,Y,Z.

I hope this helps. Einstein47
(Love is like PI - natural, irrational, endless, and very important.)
 
Ok, that helped, somewhat. Thanks.
Now for my next question: On clicking next, I need a javascript function that will loop through each vendor in the table, and make sure that at least one checkbox is checked for each vendor. So if there are 4 vendors selected into the table by the user, then at least 4 checkboxes should be checked, but more is ok.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top