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

CheckBoxList

Status
Not open for further replies.

mchoudhury

Programmer
Nov 26, 2004
71
GB
Hi Experts
I have a checkboxlist, values are retrived from the database. There are 6 checkboxes. If a user checks a checkbox how would i write the script to say this checkbox was selecetd
i.e. if two checkbox are selected how would i write
a.checked
b.checked

using the checkboxlist attributes

hope someone could help

thanks
 
to process the form server-side remember that a checked checkbox is "on"

Code:
for each item in request.fields
  if request(item) = "on" then
    response.write "<br>" & item & " is checked"
  end if
next


Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook
zen.gif

 
Umm, but that would only work if i created my checkboxes like so:
Code:
<input type="checkbox" name="whatever" value="on">
Just thought I would point that out. If you accidentally make your checkbox values = "yes" then the above code wouldn't do much for ya :)

-T

barcode_1.gif
 
Tarwn - I thought that checkboxes always read as "on" regardless of the value you set for them - am I wrong?

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook
zen.gif

 
I'm not using checkbox attribute but checkboxlist attribute. anyway found a solution to overcome my problem:

if checkboxlistname.Items(0).Selected = True then
do this
End if
 
If you are using .NET, you need to direct your questions to the proper forum. Forum855

------------------------------------------------------------------------------------------------------------------------
If you don't have a sense of humor, you probably don't have any sense at all.
- Anonymous
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top