Click to See Complete Forum and Search --> : Counting Checkboxes


dep
12-31-2002, 08:18 AM
Hello. I am going to have a form with several checkboxes.

Lets say it would be labeled "2002 Responsibilities"
[] item1
[] item2
...
[] item50

I want the user to only be able to select 10 responsibilities. When he tries to click on the 11th item, it would say "You can only have a maximum of 10." and then do nothing.

How can I accomplish this? My programming in server side, ASP type stuff is pretty good, but I'm not really strong on the browser-side javascript stuff.

thanks.
dep

luc
12-31-2002, 09:30 AM
try

http://javascript.internet.com/forms/limit-boxes.html

dep
12-31-2002, 09:37 AM
ty ;)

dep
12-31-2002, 09:53 AM
actually this is not very efficient for my form, since i have a large number of dynamic textboxes. how would i do this for an "ever-changing" number of textboxes? that script would be ideal for 3 to 5 static boxes.

any help is appreciated.

thanks,
dep

luc
12-31-2002, 10:00 AM
It' strue indeed :rolleyes:

I've just searched on that site for a quick solution...

If you take a look to some other scripts, I guess you can work it out.

If you look at

http://javascript.internet.com/buttons/check-all.html

the checkboxes will be dynamically validated...

I hope this will help you out?