0

How to validate the group checkbox in html5? Because For each checkbox I have I am giving required, how do we do if I want to group the checkbox for validation. SO far what I have done I have given my code.can any one guide me because I am planning to use html5 validation now days every body updating the browser frequently. my questions are?

  1. I don't like to give each field in checkbox required?I want to know which attribute I want to use to group the checkbox validation in html5?
  2. Is it enough to do html5 validation alone?
  3. will it support for all browsers?
<form name="vk" action="" method="post"/>
        Name:<input type="name" name="username" value="" required/><br/><br/>
        password:<input type="password" name="password" value="" required/><br/><br/>
        Please select subject:
        <input type="checkbox" name="subject[]" id="all" value="all" required>All Subject
        <input type="checkbox" name="subject[]"  value="science" required>Science
        <input type="checkbox" name="subject[]"  value="maths">Maths<br/><br/><br/>

        Please select Subject for class twelve<br/>

        <input type="checkbox" name="classfivesubject[]" id="mat" value="BScTuition (Physics)">BScTuition (Physics)<br/>
        <input type="checkbox" name="classfivesubject[]" id="mat" value="BSc Tuition (Chemistry)">BSc Tuition (Chemistry)<br/>
        <input type="checkbox" name="classfivesubject[]" id="mat" value="BCA Tuition (Computer)">BCA Tuition (Computer)<br/>
        <input type="checkbox" name="classfivesubject[]" id="mat" value="BCA Tuition (IT)">BCA Tuition (IT)<br/>
        <input type="checkbox" name="classfivesubject[]" id="mat" value="BSc Tuition (Biology)">BSc Tuition (Biology)<br/>
        <input type="checkbox" name="classfivesubject[]" id="mat" value="BSc Tuition (MicroBiology)">BSc Tuition (MicroBiology)<br/>
        <input type="checkbox" name="BSc Tuition (MicroBiology)" id="mat" value="BSc Tuition (MicroBiology)">BSc Tuition (MicroBiology)
        <input type="checkbox" name="BSc Tuition (Zoology)" id="mat" value="BSc Tuition (Zoology)">BSc Tuition (MicroBiology)<br/>
        <input type="submit" name="submit" value="Submit"/>
        </form>
Pavlo
  • 43,301
  • 14
  • 77
  • 113
mathew john
  • 163
  • 9
  • can any one guide me what attribute I need to use – mathew john Feb 13 '15 at 11:33
  • possible duplicate of [Using the HTML5 "required" attribute for a group of checkboxes?](http://stackoverflow.com/questions/6218494/using-the-html5-required-attribute-for-a-group-of-checkboxes) – worpet Feb 13 '15 at 16:48

0 Answers0