Checkboxes

Assuming you have read the basics for inputfields and their naming, the same rules and conventions apply for checkboxes.

Just like with radio buttons a difference is found in the way the form remembers the previous setting (after a rejected submit).
The previous selected input field will need to have "checked="checked" to reactivate the previous choice.

To do that we can use the fieldname + value as "remember" field. Set in uppercase, linked with an underscore and between curly brackets it looks like the line below.

<input type="checkbox" id="news-1" {NEWSLETTER_NEWS_YES} name="mf_newsletter_news" value="Yes" />Yes

In this case, if the field is not selected the email will have the name with a blank result.
You can trick the form to have a default value for the field if it is not checked by adding a hidden field with the same name before this field.

<input type="hidden" name="mf_newsletter_news" value="No" />
<input type="checkbox" id="news-1" {NEWSLETTER_NEWS_YES} name="mf_newsletter_news" value="Yes" />Yes

This way the "No" value is used, unless the checkbox is clicked. In that case the "Yes" value will be used.

Multiple selections

You can use multiple checkboxes with the same name too. To make a form behave like that you need to creat the fieldnames as an array.
This is done simply by adding [ ] after the fieldname.

The example below will create a required checkbox group.

<div class="grouping {SIGNUP_ERROR}">
  <label for="signup"><span>Signup <span>*</span></span>
    <input type="checkbox" id="signup" {SIGNUP_NEWSLETTER} name="mf_signup[]" value="Newsletter">Newsletter
    <input type="checkbox" id="signup" {SIGNUP_UPDATES} name="mf_signup[]" value="Updates">Future updates
  </label>
</div>

If both checkboxes are checked the resulting email will have:

Signup: Newsletter, Future updates