File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Validating that checkbox is checked.

 
Bosun Bello
Ranch Hand
Posts: 1510
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

 
manav kher
Ranch Hand
Posts: 98
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
u can ref the radiogroup as an array so the fields are daysOfWeek[0]
and u can validate it as
if(document.myForm.daysOfWeek[0].checked)
u get the picture right?
-manav
 
Bosun Bello
Ranch Hand
Posts: 1510
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yep! Got it working...Thanks.
------------------
Bosun
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic