Validation for check box?

Results 1 to 2 of 2

Thread: Validation for check box?

  1. #1
    Join Date
    Dec 1969

    Default Validation for check box?

    Hello all,<BR><BR> I am getting values from the database to create check boxes, the check boxes are obtained depending on different categories.<BR>I just need to validate if the user doesn&#039;t select a check box, it should alert him to select, but we will not be sure how many check boxes exist, it all depends on the database field, since it is created dynamically. how do I do this??<BR><BR>Thanks for any help.

  2. #2
    Join Date
    Dec 1969

    Default RE: Validation for check box?

    how about something like this.<BR><BR>var somethingchecked = false;<BR><BR>for(x=0;x&#060;form.length;x++) {<BR> if(form.elements[x].type==&#039;checkbox&#039;&&form.elements[x].checked==true) {<BR> somethingchecked = true;<BR> }<BR><BR>}<BR>if(!somethingchecked) {<BR> alert(&#039;please check at least one box&#039;);<BR>}<BR><BR><BR>j

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts