WordPress Mailchimp Form custom checkbox

I’m using the Mailchimp subscription plugin for wordpress (v. 1.2.13). It’s all ok, I just need to add a checkbox to accept privacy terms. I’ve created that field through the Mailchimp form managment, it shows and works in the form except that I need to define it as required. There is no option for that in mailchimp, i tried to add a simple “required” attribute in html, but it didn’t work (as expected).

Any suggestion?

Read More

I’ve also spotted that Mailchimp define if that field is required in an array/place called $var['req'] that is someway connected with the field name. But I can’t find where can I access this array or how to add my custom field to that.

Related posts

Leave a Reply

2 comments

  1. I have added the link to your post where the Advanced management for forms is to be accessed in MailChimp. Here it is again

    But well, its only available to paid users. You can customize every bit of the form in that place.

  2. This should work:

    <input type="checkbox" id="acceptterms" />
    

    Then presuming your MailChimp ‘Subscribe’ link has an ID of ‘mailchimpsubscribe’ then you can do the following:

    <script language="javascript" type="text/javascript"> jQuery('#mailchimpsubscribe').click(function() { if (jQuery('#acceptterms').prop('checked') == false) {return false; } }); </script>
    

    So basically you’re adding a click event to your MailChimp submit button and checking if the terms checkbox has been ticked – if not, return false so the click doesn’t complete.