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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

requesting the value of a checkbox

Status
Not open for further replies.

achmo

Programmer
Aug 30, 2001
56
IL
hello,

I am submitting a form (including many checkboxes) to an asp page where I analize the data. All the checkboxes that are not checked are not passed to the asp page - for example, I'ts not that I get GiftWrap="", but rather the GiftWrap checkbox does not appear on the address box of the asp page at all, so I can't analize it using request.

Is there a way around this? I could use a long list of "If"'s on the asp page, checking for the existance of all the checkboxes, but this is a very long way. Is there a way to make the default value of a checkbox 0?

Thanks,
Yael
 
So you want to keep track of the checkbox's not checked?

www.vzio.com
ASP WEB DEVELOPMENT



 
Even if you change the default value of the checkbox it will not be passed as part of them form data. What happens with checkboxes is only those that have been checked get passed to the next page. You could consider creating a hidden field with a comma-delimited list of all the values for the checkboxes and pass that as well, or create a piece of client side code that loops through the checkbox items and adds them to the value of a hidden field if they are not checked.
If this is clos to what you were looking for, but would like an example, let me know.
-Tarwn ------------ My Little Dictionary ---------
Reverse Engineering - The expensive solution to not paying for proper documentation
 
Cant you assume that the checkbox is not checked if there is no value when you request it.

if request("check") = "" then
checkbox = false
else
checkbox = true
end if
 
Rico, this way isn't go to work for people in most cases, because if you have dozens and dozens of checkboxes you don' want to request each checkbox, you want to request two forms, and split all the values, like suggested by Tawrn it would be the smarter route. www.vzio.com
ASP WEB DEVELOPMENT



 
thanks, just got back from a vacation and going to use your ideas!

Yael
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top