Add a group choice to CF7 forms

If you are using a sign-up checkbox in your Contact Form 7 forms you sometimes want to give a choice to sign up to different interest groups.

The easiest way to do this is by first generating the code for Interest groups in the Form builder under MailChimp for WP > Forms > Fields. When you click the button above the form builder with the name of your interest group you can choose between Dropdown, Radio buttons or Checkboxes. Depending on your choice the code looks a bit different. Then copy the generated HTML to your Contact Form 7 form.

Now all that is left is adding the mc4wp- prefix to the name attribute, so our plugin knows to send the value of that field to your selected MailChimp list.

<select name="mc4wp-INTERESTS[ec75a797c8]">
<option value="5527b34480">Interest group 1</option>
<option value="462b888077">Interest group 2</option>
</select>

If you went with checkboxes you have to add the mc4wp- prefix to each individual "name" attribute.

<input name="mc4wp-INTERESTS[ec75a797c8][]" type="checkbox" value="5527b34480" /> Interest group 1
<input name="mc4wp-INTERESTS[ec75a797c8][]" type="checkbox" value="462b888077" /> Interest group 2

You can also hide the choice (make it implicit) by changing the type from "checkbox" to "hidden".

<input name="mc4wp-INTERESTS[ec75a797c8][]" type="hidden" value="5527b34480" />

The code in the examples above are purely illustrative. Make sure to generate the code with your own interestgroup names and id's via MailChimp for WP > Forms > Fields.

If interest groups that you recently created in MailChimp are not showing in the form builder yet, go to MailChimp for WP > Mailchimp and click the "Renew Lists" button.

Was this article helpful? ·