html required attribute for checkbox
-
Hi,
I have a very simple form to sign people up to my mailchimp list. There are only 2 fields, email and a checkbox so people give consent to sign up. But I need this checkbox to be required for GDPR compliance. I am trying to simply add the html required attribute to the checkbox but when I do that the form will not send and I get the message “Please fill in all required fields” even though the checkbox was ticked.
If I do not set the required field the form sends fine. I have tried the attribute required=”required” and also just required as per html says (https://www.w3schools.com/tags/att_input_required.asp)My form in Mailchimp for WP > Forms is basically this:
<p> <label>Tick to consent</label> <label> <input name="INTERESTS[xxxxxxxx][]" type="checkbox" value="xxxxxxxxxx" required="required"> <span>I consent to XXXXXX collecting my email address</span> </label> </p> <p> <label class="screen-reader-text">Email address: </label> <input type="email" value="" name="EMAIL" class="required email text" id="mce-EMAIL" placeholder="Newsletter Sign up" required="@"> <input type="submit" value="Sign up" name="subscribe" id="mc-embedded-subscribe" class="button submit"> </p>Thanks
The topic ‘html required attribute for checkbox’ is closed to new replies.