View Full Version : How to get count using checkbox
lamab
12-10-2003, 03:51 PM
Ok...heres the senerio
I have a list of files with a checkbox next to each of them. How can I get the number of check boxes selected after clicking on the submit button?
JVRudnick
12-30-2003, 10:17 AM
Set a var to the new total and DIM same and establish a value of zero.
DIM totalCheckBoxes
totalCheckBoxes = 0
Then each time you loop, do this...
totalCheckboxes = totalCheckboxes + 1
Later you can either pass that var using a querystring or a hidden or a displayed item to the next page to see what the total is...
Do you follow?
;-)
Jim
fyrye
05-16-2004, 02:45 AM
any easier method would be to set a variable up on the request.form instance of the checkbox, this only works if the checkbox field names are the same. If using different names, or several checkbox fields, you would of course need to add the others or use a loop as the above post describes
Dim myVariable, intTotalCheckboxes
myVariable = split(request.form(checkboxfieldname), ",")
intTotalCheckboxes = UBound(myVariable)
myVariable = Null
vBulletin v3.0.3, Copyright ©2000-2012, Jelsoft Enterprises Ltd.