Answers.Body: <p>When the checkbox get submitted, it get's transferred with whatever value is set with the value attribute.</p>
  
  <p>Thus, your need to set the value to 1. Your code should be more like this:</p>
  
  <pre><code>&lt;div class="checkbox"&gt;
    &lt;label&gt;
      &lt;input type="checkbox" id="memberShowEmailLink" name="fields[memberShowEmailLink]" value="1" {% if account is defined and account.memberShowEmailLink %} checked="checked"{% endif %}&gt;
      Show a link to contact me via email in the member directory?
    &lt;/label&gt;
  &lt;/div&gt;
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-01-08T16:52:36.910Z
Answers.Text: I'd like these checkboxes to be off by default, which is why I set the `value="0"` in the `else` bit of my conditional. But when I check them on in the frontend, the value is not getting transferred.
Answers.UserDisplayName: Adam Snetman
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-01-08T16:53:20.393Z
Answers.Text: They are "off" by default. The checked attribute controls if they are "on". If they aren't checked, the field isn't transferred to the server.
Answers.UserDisplayName: Fred Carlsen
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-01-08T16:58:13.133Z
Answers.Text: Got it! Tried the code you revised and it worked great. Thanks for clarifying!
Answers.UserDisplayName: Adam Snetman
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-01-08T16:47:23.887Z
Answers.LastActivityDate: 2015-01-08T17:24:31.447Z
Answers.LastEditDate: 2015-01-08T17:24:31.447Z
Answers.UserDisplayName: Fred Carlsen
Body: <p>I've got a frontend user registration form working that's populating a whole set of custom fields I've set up on my user profiles in Craft.</p>
  
  <p>But I've got a set of lightswitch fields on my user profiles that I'm trying to set via checkboxes in the registration form but the values are not transferring over when submitting the form.</p>
  
  <p>Here's an example of my checkbox code in the frontend form (the corresponding lightswitch field handle is <code>memberShowEmailLink</code>):</p>
  
  <pre><code>&lt;div class="checkbox"&gt;
    &lt;label&gt;
      &lt;input type="checkbox" id="memberShowEmailLink" name="fields[memberShowEmailLink]" {% if account is defined %}value="{{ account.memberShowEmailLink }}" checked="checked"{% else %}value="0"{% endif %}&gt;
      Show a link to contact me via email in the member directory?
    &lt;/label&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Is there a way to change it to make this work?</p>
  
Tags: <registration><custom-field><frontend>
Title: How can I translate checkboxes on a frontend user registration form to lightswitch custom fields?
ThreadText: # How can I translate checkboxes on a frontend user registration form to lightswitch custom fields?
  
  (Asked by: username_0 on 2015-01-08)
  
  I've got a frontend user registration form working that's populating a whole set of custom fields I've set up on my user profiles in Craft.
  
  But I've got a set of lightswitch fields on my user profiles that I'm trying to set via checkboxes in the registration form but the values are not transferring over when submitting the form.
  
  Here's an example of my checkbox code in the frontend form (the corresponding lightswitch field handle is `memberShowEmailLink`):
  
  ```
  <div class="checkbox">
    <label>
      <input type="checkbox" id="memberShowEmailLink" name="fields[memberShowEmailLink]" {% if account is defined %}value="{{ account.memberShowEmailLink }}" checked="checked"{% else %}value="0"{% endif %}>
      Show a link to contact me via email in the member directory?
    </label>
  </div>
  
  ```
  
  Is there a way to change it to make this work?
  
  **Tags:** registration, custom-field, frontend
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-01-08. Score: 1 | Accepted answer
  
  When the checkbox get submitted, it get's transferred with whatever value is set with the value attribute.
  
  Thus, your need to set the value to 1. Your code should be more like this:
  
  ```
  <div class="checkbox">
    <label>
      <input type="checkbox" id="memberShowEmailLink" name="fields[memberShowEmailLink]" value="1" {% if account is defined and account.memberShowEmailLink %} checked="checked"{% endif %}>
      Show a link to contact me via email in the member directory?
    </label>
  </div>
  
  ```
  
  > **Comments:**
  > **username_0**: I'd like these checkboxes to be off by default, which is why I set the `value="0"` in the `else` bit of my conditional. But when I check them on in the frontend, the value is not getting transferred.  
  > **username_1**: They are "off" by default. The checked attribute controls if they are "on". If they aren't checked, the field isn't transferred to the server.  
  > **username_0**: Got it! Tried the code you revised and it worked great. Thanks for clarifying!  
  
  ---
  
  