How to implement checkboxes

Negative Responses

An unchecked checkbox does not send any data when your form is submitted. This means that you will not see negative responses to checkbox data within FormKeep. To fix this, add a hidden field with the exact same name as your checkbox field directly before the checkbox in the HTML:


<input type="hidden" name="do_you_like_pie" value="no">
<input type="checkbox" name="do_you_like_pie" value="yes">

If the user checks the visible checkbox, it will submit the value of the checkbox field. If the user doesn't check the checkbox, it will fall back to using the value of the hidden field.


Multiple Answers to One Question

Input arrays allow you to ask the user for multiple answers to one question. To implement, simply add brackets ([]) to the end of the name attribute for each input.


<input type="checkbox" name="which_pies_do_you_like[]" value="Apple">
<input type="checkbox" name="which_pies_do_you_like[]" value="Cherry">
<input type="checkbox" name="which_pies_do_you_like[]" value="Pumpkin">
<input type="checkbox" name="which_pies_do_you_like[]" value="Pecan">

That's it! Why not get started now?

Looking for something else?

Email us @formkeep