Answers.Body: <p>You need to include a hidden field with the value of <code>0</code> before the checkbox to ensure that the value is included in the form data if the checkbox is unchecked. See the docs on <a href="https://craftcms.com/docs/checkboxes-fields#templating" rel="nofollow">templating for checkbox fields</a>.</p>
  
  <p>So you'll need to have this in your form:</p>
  
  <pre><code>&lt;input type="hidden" name="enabled" value="0"&gt;
  &lt;input type="checkbox" name="enabled" id="enabled" value="1"{{ entry.enabled == '1' ? ' checked' }}&gt;
  </code></pre>
  
  <p>When the checkbox is checked, the value of <code>1</code> for <code>enabled</code> will override the value of the earlier hidden field.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-07-27T10:45:03.497Z
Answers.Text: Thanks Steve. Did not know that. Alas, it hasn't solved the problem.
Answers.UserDisplayName: Ian Ebden
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-07-27T10:55:53.840Z
Answers.Text: Hmm. It's working for me. What's the problem? Don't forget that to show disabled entries on the front end you'll need to add a `status(null)` criteria to the `craft.entries` tag. Also, does the user your trying to do this with have appropriate permissions for the section your entries are in?
Answers.UserDisplayName: Steve Rowling
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-07-27T11:24:43.033Z
Answers.Text: Yep, that all checks out but no dice. I'm going to have to dig a little deeper. I'll post the answer once I have it.
Answers.UserDisplayName: Ian Ebden
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-07-27T12:11:22.490Z
Answers.Text: Seems I can disable fine but cannot enable again after, which suggests to me it's some kind of permissions thing. Yet I'm logged in as Admin with full rights. Tried different sections too.
Answers.UserDisplayName: Ian Ebden
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-07-27T14:43:37.560Z
Answers.Text: Have you got dev mode on and looked in the logs to see if there is anything helpful in there? Does the entry save, but remain disabled? Or does it fail to save any changes? I've double-checked here and it's working for me when logged in as an Admin so it does sound like there is perhaps a permissions issue or something else preventing it working for you.
Answers.UserDisplayName: Steve Rowling
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-07-27T15:30:41.287Z
Answers.Text: Yeah dev mode is on but nothing weird I can see in the logs. Entry changes save fine, just not the status. I'll keep digging. Thanks for your help though!
Answers.UserDisplayName: Ian Ebden
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-07-27T15:32:55.857Z
Answers.Text: Just checking that you are setting the value of the checkbox to `1` and not using the existing value of `entry.enabled` as you've got in the snippet in your question?
Answers.UserDisplayName: Steve Rowling
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-07-27T18:36:21.437Z
Answers.Text: Yeah, I corrected that. So I've now got: `<input type="hidden" name="enabled" value="0">
          <input type="checkbox" name="enabled" for="enabled" value="1"{{ entry.enabled == '1' ? ' checked' }}>`. Going to look at it with fresh eyes tomorrow.
Answers.UserDisplayName: Ian Ebden
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-07-27T10:16:55.553Z
Answers.LastActivityDate: 2016-07-27T10:16:55.553Z
Answers.UserDisplayName: Steve Rowling
Body: <p>I'm going wrong here somewhere, but I have a (edit) entry form and I'd like a 'disable' field to change status. The edit form works fine but status changes are ignored. Here's my field:</p>
  
  <pre><code>&lt;input type="checkbox" name="enabled" id="enabled" value="{{ entry.enabled }}"{{ entry.enabled == '1' ? ' checked' }}&gt;
  </code></pre>
  
  <p>Am I missing something? Thanks guys.</p>
  
Tags: <form><entry><status>
Title: Change entry status on front end
ThreadText: # Change entry status on front end
  
  (Asked by: username_0 on 2016-07-27)
  
  I'm going wrong here somewhere, but I have a (edit) entry form and I'd like a 'disable' field to change status. The edit form works fine but status changes are ignored. Here's my field:
  
  ```
  <input type="checkbox" name="enabled" id="enabled" value="{{ entry.enabled }}"{{ entry.enabled == '1' ? ' checked' }}>
  
  ```
  
  Am I missing something? Thanks guys.
  
  **Tags:** form, entry, status
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-07-27. Score: 4
  
  You need to include a hidden field with the value of `0` before the checkbox to ensure that the value is included in the form data if the checkbox is unchecked. See the docs on [templating for checkbox fields](https://craftcms.com/docs/checkboxes-fields#templating).
  
  So you'll need to have this in your form:
  
  ```
  <input type="hidden" name="enabled" value="0">
  <input type="checkbox" name="enabled" id="enabled" value="1"{{ entry.enabled == '1' ? ' checked' }}>
  
  ```
  
  When the checkbox is checked, the value of `1` for `enabled` will override the value of the earlier hidden field.
  
  > **Comments:**
  > **username_0**: Thanks username_1. Did not know that. Alas, it hasn't solved the problem.  
  > **username_1**: Hmm. It's working for me. What's the problem? Don't forget that to show disabled entries on the front end you'll need to add a `status(null)` criteria to the `craft.entries` tag. Also, does the user your trying to do this with have appropriate permissions for the section your entries are in?  
  > **username_0**: Yep, that all checks out but no dice. I'm going to have to dig a little deeper. I'll post the answer once I have it.  
  > **username_0**: Seems I can disable fine but cannot enable again after, which suggests to me it's some kind of permissions thing. Yet I'm logged in as Admin with full rights. Tried different sections too.  
  > **username_1**: Have you got dev mode on and looked in the logs to see if there is anything helpful in there? Does the entry save, but remain disabled? Or does it fail to save any changes? I've double-checked here and it's working for me when logged in as an Admin so it does sound like there is perhaps a permissions issue or something else preventing it working for you.  
  > **username_0**: Yeah dev mode is on but nothing weird I can see in the logs. Entry changes save fine, just not the status. I'll keep digging. Thanks for your help though!  
  > **username_1**: Just checking that you are setting the value of the checkbox to `1` and not using the existing value of `entry.enabled` as you've got in the snippet in your question?  
  > **username_0**: Yeah, I corrected that. So I've now got: `<input type="hidden" name="enabled" value="0">         <input type="checkbox" name="enabled" for="enabled" value="1"{{ entry.enabled == '1' ? ' checked' }}>`. Going to look at it with fresh eyes tomorrow.  
  
  ---
  
  