It's not a secret anymore!
The moose likes HTML, CSS and JavaScript and the fly likes Validating that checkbox is checked. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Validating that checkbox is checked." Watch "Validating that checkbox is checked." New topic

Validating that checkbox is checked.

Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
Does anyone know how do validate that at least one checkbox out of a group of checkboxes is checked. Note: This checkboxes have the same name. I know I can give them the same name (see below) and then validate each of them. But I am processing them as a group using servlets(getParameterValues), so I would like to know if I can put them in a javascript array and then validate thet at least one is checked..
<INPUT TYPE="checkbox" NAME="daysOfWeek" VALUE="2">Monday</TD>
<INPUT TYPE="checkbox" NAME="daysOfWeek" VALUE="3">Tuesday</TD>
<INPUT TYPE="checkbox" NAME="daysOfWeek" VALUE="4">Wednesday</TD>

Thanks, Bosun

So much trouble in the world -- Bob Marley
manav kher
Ranch Hand

Joined: Nov 21, 2000
Posts: 98
u can ref the radiogroup as an array so the fields are daysOfWeek[0]
and u can validate it as
u get the picture right?
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
Yep! Got it working...Thanks.
Have you checked out Aspose?
subject: Validating that checkbox is checked.
jQuery in Action, 3rd edition