<p>The bug was fixed for me in 1.6.2 my final code was just a simple:</p>

<pre><code>&lt;input type="checkbox"
        name="{{ receiveContactFromTFA.handle }}"
        value="{{ receiveContactFromTFA.value }}"
        {% if receiveContactFromTFA.value == 'Yes' %} checked{% endif %}&gt;
</code></pre>

CC BY-SA 3.0
2017-10-28T08:39:19.833Z
2017-10-28T08:39:19.833Z
Gareth
<p>This still appears to be an issue with checkboxes on Freeform Craft 1.6.2. The mailing list checkbox is repopulating as expected but the checkbox field is not repopulating in a multi-step form after submitting and going back. All fields have a value of 1.</p>

CC BY-SA 3.0
2017-10-28T08:37:28.207Z
This looks to be fixed in 1.6.3 https://solspace.com/craft/freeform/docs/changelog/#v1-6-3 my forms don't use a multi-step process through so I can't confirm.
Gareth
CC BY-SA 3.0
2017-10-13T17:09:32.817Z
2017-10-13T17:09:32.817Z
Doug St. John
<p>I don't think this has anything to do with your code, and actually appears to be a bug in Freeform itself, where the Submission object and email notifications are showing the value as whatever the default is set to.</p>

<p>I've made a note about this issue and we'll have it corrected shortly. :)</p>

CC BY-SA 3.0
2017-09-13T04:59:12.797Z
Thank you for looking into this. Once I've got it working with the bug fix I'll post my code here for completeness.
Gareth
CC BY-SA 3.0
2017-09-13T02:32:21.247Z
2017-09-13T02:32:21.247Z
Solspace
<p>Using Freeform, I am wanting to have a checkbox on a front end form that is not checked by default that posts 'Yes' if checked and 'No' if not checked. I am creating a manual HTML form that works fine for all the other fields, but I can't figure out what to write for the checkbox logic.</p>

<p>From the <a href="https://solspace.com/craft/freeform/docs/field/#field-checkbox" rel="nofollow noreferrer">docs</a> I know I can set the value in the back end to a default of either 'Yes' or 'No', I have done this and using the following template code but it always sends through the same value of either Yes or No depending on what you set in the back end.</p>

<pre><code>&lt;input type="checkbox"
        name="{{ receiveContactFromTFA.handle }}"
        value="{{ receiveContactFromTFA.value == 'Yes' ? 'Yes' : 'No' }}"
        {% if receiveContactFromTFA.value == 'Yes' %} checked{% endif %}&gt;
</code></pre>

<p>I have also just tried not having a value attribute at all but again the value defaults to yes because it is set in the back end. I have also tried removing the value entirely and having the following template code:</p>

<pre><code>&lt;input type="checkbox"
        name="{{ receiveContactFromTFA.handle }}"&gt;
</code></pre>

<p>If I do that then then nothing posts. I know a checkbox will normally post a '1' if checked but how do you handle this logic using Freeform to be either 'Yes' or 'No'?</p>

<plugin-freeform>
How to set simple yes/no checkbox using Freeform
# How to set simple yes/no checkbox using Freeform

(Asked by: username_0 on 2017-09-12)

Using Freeform, I am wanting to have a checkbox on a front end form that is not checked by default that posts 'Yes' if checked and 'No' if not checked. I am creating a manual HTML form that works fine for all the other fields, but I can't figure out what to write for the checkbox logic.
From the docs I know I can set the value in the back end to a default of either 'Yes' or 'No', I have done this and using the following template code but it always sends through the same value of either Yes or No depending on what you set in the back end.


I have also just tried not having a value attribute at all but again the value defaults to yes because it is set in the back end. I have also tried removing the value entirely and having the following template code:


If I do that then then nothing posts. I know a checkbox will normally post a '1' if checked but how do you handle this logic using Freeform to be either 'Yes' or 'No'?

**Tags:** plugin-freeform

---

## 3 answers

### Answer by username_0 on 2017-10-28. Score: 0 | Accepted answer

The bug was fixed for me in 1.6.2 my final code was just a simple:


---

### Answer by username_1 on 2017-10-13. Score: 2

This still appears to be an issue with checkboxes on Freeform Craft 1.6.2. The mailing list checkbox is repopulating as expected but the checkbox field is not repopulating in a multi-step form after submitting and going back. All fields have a value of 1.

> **Comments:**
> **username_0**: This looks to be fixed in 1.6.3 https://solspace.com/craft/freeform/docs/changelog/#v1-6-3 my forms don't use a multi-step process through so I can't confirm.  

---

### Answer by username_2 on 2017-09-13. Score: 2

I don't think this has anything to do with your code, and actually appears to be a bug in Freeform itself, where the Submission object and email notifications are showing the value as whatever the default is set to.

I've made a note about this issue and we'll have it corrected shortly. :)

> **Comments:**
> **username_0**: Thank you for looking into this. Once I've got it working with the bug fix I'll post my code here for completeness.  

---

