+ Start a Discussion
Robert WynterRobert Wynter 

In a CloudePage Form. How can I validate two checkboxes so that at least one or both are checked

I need the user to select either both or at least one of the checkboxes.

Thank you in advance for your help:)       
<tr>
          <td>
            <input type="checkbox" name="Email_Opt_in" id="Email_Opt_in" value="True" >  Please click here to allow us to continue to contact you via email. 
          </td> 
        </tr>
        <tr>
          <td>
            <input type="checkbox" name="Mobile_Opt_in" id="Mobile_Opt_in" value="True" >  Please click here to allow us to continue to contact you via phone. 
          </td> 
        </tr> 
Robert WynterRobert Wynter
I tried this but it didn't work:
<script type="text/javascript"> 
       function validate() 
       { 
       var emailoptin=document.getElementById("Email_Opt_in").value; 
       var phoneoptin=document.getElementById("Mobile_Opt_in").value; 
       submitOK="true"; 
       if (emailoptin.length<1) 
       {  
       var Valert = "Please Enter your emailoptin \n"; 
       submitOK="false"; 
       } 
               else 
       { 
       var Valert = ""; 
       } 
       if (submitOK=="false") 
       { 
       alert(Valert); 
       return false; 
       } 
              } 
       </script>