Answers.Body: <p>The Lightswitch field is a simple boolean/tinyint column, with a 0/1 value. For this to work, you want to do something like this:</p>
  
  <pre><code>&lt;input type="checkbox" name="fields[gistDraft]" value="1" {% if entry.gistDraft %} checked="checked"{% endif %} /&gt;
  </code></pre>
  
  <p>If you are sending the value some other way than a checkbox (the lightswitch field is a hidden checkbox), make sure that gistDraft has a value of 0 (off) or 1 (on).</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-09-21T10:34:09.560Z
Answers.LastActivityDate: 2014-09-21T14:27:24.573Z
Answers.LastEditDate: 2014-09-21T14:27:24.573Z
Answers.UserDisplayName: Fred Carlsen
Body: <p>I have the following buttons on my frontend entry from (user editing one of their entries). The idea is to turn the lightswitch "on" (green) when entry is being marked as draft and "off" when submitted for review. The turning it "on" part seems to work. I just cannot seem to control its "off" state.</p>
  
  <pre><code>   &lt;div class="col-md-6"&gt;
          &lt;button class="btn btn-primary btn-lg btn-block " style="margin:10px 15px 0 0;" type="submit"  name="fields[gistDraft]" value="true"&gt;Save as Draft&lt;/button&gt;
      &lt;/div&gt;  
     &lt;div class="col-md-6"&gt;
            &lt;button class="btn btn-success  btn-lg btn-block " style="margin:10px 15px 0 0;" type="submit"    name="fields[gistDraft]" value="false"&gt;Save &amp;amp; Submit for Review&lt;/button&gt;
          &lt;/form&gt;
      &lt;/div&gt;  
  </code></pre>
  
Tags: <form><entry><lightswitch>
Title: Populate Lightswitch field from Frontend Entry Form
ThreadText: # Populate Lightswitch field from Frontend Entry Form
  
  (Asked by: username_0 on 2014-09-19)
  
  I have the following buttons on my frontend entry from (user editing one of their entries). The idea is to turn the lightswitch "on" (green) when entry is being marked as draft and "off" when submitted for review. The turning it "on" part seems to work. I just cannot seem to control its "off" state.
  
  ```
     <div class="col-md-6">
          <button class="btn btn-primary btn-lg btn-block " style="margin:10px 15px 0 0;" type="submit"  name="fields[gistDraft]" value="true">Save as Draft</button>
      </div>  
     <div class="col-md-6">
            <button class="btn btn-success  btn-lg btn-block " style="margin:10px 15px 0 0;" type="submit"    name="fields[gistDraft]" value="false">Save &amp; Submit for Review</button>
          </form>
      </div>  
  
  ```
  
  **Tags:** form, entry, lightswitch
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2014-09-21. Score: 3 | Accepted answer
  
  The Lightswitch field is a simple boolean/tinyint column, with a 0/1 value. For this to work, you want to do something like this:
  
  ```
  <input type="checkbox" name="fields[gistDraft]" value="1" {% if entry.gistDraft %} checked="checked"{% endif %} />
  
  ```
  
  If you are sending the value some other way than a checkbox (the lightswitch field is a hidden checkbox), make sure that gistDraft has a value of 0 (off) or 1 (on).
  
  
  ---
  
  