We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23510
    • 168 Posts
    My register form needs two checkboxes that have to be checked in order for the form process to continue.

    I haven’t been able to get this to work. Here are the two input fields. The state of each checkbox is retained after submitting the form, but checking both boxes and completing the rest of the form does not pass validation. In fact even removing the :required still does not register the user.

          <label for="confirm_disclaimer">
            <span class="input-centred">
    <input type="checkbox" name="confirm_disclaimer:required" id="confirm_disclaimer" value="Y" [[!+confirm_disclaimer:FormItIsChecked=`Y`]] />Confirm that you have read and agree to our <a href="">Disclaimer</a>
    
    [[!+error.confirm_disclaimer]]
    </span></label>
        
          <label for="confirm_privacy">
            <span class="input-centred">
    <input type="checkbox" name="confirm_privacy:required" id="confirm_privacy" value="Y" [[!+confirm_privacy:FormItIsChecked=`Y`]] />Confirm that you have read and agree to our <a href="">Privacy Policy</a>
    		
    [[!+error.confirm_privacy]]
    </span></label>


    Thanks in advance to anyone who can point me in the right direction.
      • 23510
      • 168 Posts
      I guess I will have to use jquery. But im sure someone out there has used a checkbox in their register form at some point.
        • 38878
        • 255 Posts
        I know this post is a year old but I thought I would share what I found as I coudn't find anything in the doc either and I am having the same issue.

        I assumed when the validation wasn't failing for the empty checkbox that it may have to do with the validation syntax for checkboxes so tried a few things. What ended up working was this syntax in the validate argument list:
        terms_accepted:required:true


        Hope I can save someone an hour;)