Title: checkbox not validating
Last modified: December 6, 2023

---

# checkbox not validating

 *  Resolved [dschmidtke](https://wordpress.org/support/users/dschmidtke/)
 * (@dschmidtke)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/checkbox-not-validating/)
 * A checkbox with required attribute as well as the GDPR form element do not validate
   when checked.
 * Steps to reproduce in Formello 2.2.2:
    - Create a new contact form
    - Add GDPR to the contact form
    - Publish it
    - Add the contact form to a new page an try it out.

Viewing 10 replies - 1 through 10 (of 10 total)

 *  Plugin Author [tropicalista](https://wordpress.org/support/users/tropicalista/)
 * (@tropicalista)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/checkbox-not-validating/#post-17261029)
 * Can you check if latest update solve this problem?
 *  Thread Starter [dschmidtke](https://wordpress.org/support/users/dschmidtke/)
 * (@dschmidtke)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/checkbox-not-validating/#post-17262066)
 * No, it didn’t solve the problem. Here is the markup of the gdpr block used:
 *     ```wp-block-code
       <!-- wp:formello/input {"advanced":false} -->
       <div class="formello formello-checkbox"><label class="" for="field_99ef3d"><span>Ich stimme zu</span><span class="required">*</span></label><input name="checkbox" id="field_99ef3d" type="checkbox" required class=""/></div>
       <!-- /wp:formello/input -->
       ```
   
 * And here ist the markup for the enclosing form block:
 *     ```wp-block-code
       <!-- wp:formello/form {"successMessage":"Vielen Dank! Ihre Bestellung wurde gesendet.","errorMessage":"Entschuldigung. Ihre Eingaben sind noch nicht komplett.","lock":{"move":false,"remove":false},"className":"as-row","style":{"spacing":{"padding":{"top":"0","right":"0","bottom":"0","left":"0"}}}} -->
       <form class="wp-block-formello-form as-row" style="padding-top:0;padding-right:0;padding-bottom:0;padding-left:0" method="post" data-id="151" data-hide="true" data-validate="true" novalidate>
       ```
   
 *  Thread Starter [dschmidtke](https://wordpress.org/support/users/dschmidtke/)
 * (@dschmidtke)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/checkbox-not-validating/#post-17262079)
 * Moreover after removing the checkbox block, the form does not submit anymore 
   in Formello 2.3.1, outputting
 *     ```wp-block-code
       SyntaxError: Unexpected token '<', "
       Es gab "... is not valid JSON
       ```
   
 *  Plugin Author [tropicalista](https://wordpress.org/support/users/tropicalista/)
 * (@tropicalista)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/checkbox-not-validating/#post-17262765)
 * Can you share a live link?
 *  Thread Starter [dschmidtke](https://wordpress.org/support/users/dschmidtke/)
 * (@dschmidtke)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/checkbox-not-validating/#post-17263230)
 * No, I cannot share a link, since the website is in production and I have to roll
   back immediately.
 * However, I noticed that you provided another update (2.3.2). I performed the 
   update again, had the same problem with a checked checkbox not validating, but
   the json error after removing the checkbox block is gone.
 * So I am on 2.3.2 now without a checkbox.
 *  Plugin Author [tropicalista](https://wordpress.org/support/users/tropicalista/)
 * (@tropicalista)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/checkbox-not-validating/#post-17263306)
 * Can you try to set a value for checkbox?
 *  Thread Starter [dschmidtke](https://wordpress.org/support/users/dschmidtke/)
 * (@dschmidtke)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/checkbox-not-validating/#post-17266354)
 * Yes, that’s it – the missing value. With JavaScript validation enabled, the form
   does not validate without a value for the checkbox. As soon as I set “on” as 
   a value it worked.
 * However, with JavaScipt validation disabled and HTML5 validation only, the form
   validates even without a value. And that’s how it’s supposed to work since the
   HTML spec says that if a checkbox name is submitted with empty value the default
   value should be “on”.
 * So I suggest that you rework the JS validation in Formello and make empty checkboxes
   validate with “on” as default value.
 * Thanks for your support!
 *  Plugin Author [tropicalista](https://wordpress.org/support/users/tropicalista/)
 * (@tropicalista)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/checkbox-not-validating/#post-17266702)
 * I have made some changes to 2.3.3 that perform exactly what you are saying. So
   this is solved.
   The only differences is that I set “yes” as default value instead
   on “on” if value is missing.I’d probably add a setting to let user choose what
   is default. What are you thoughts?
 *  Plugin Author [tropicalista](https://wordpress.org/support/users/tropicalista/)
 * (@tropicalista)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/checkbox-not-validating/#post-17269699)
 * This is solved. Let me know if you nedd further assistance. Thanks
 *  Thread Starter [dschmidtke](https://wordpress.org/support/users/dschmidtke/)
 * (@dschmidtke)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/checkbox-not-validating/#post-17270458)
 * Sorry for the late reply. I thought about setting a default value or not, and
   came to the conclusion, that it might be the safest not to set any default – 
   neither “yes” nor “on” – but perform the JS validation in a way where a checkbox,
   that is checked but has no value, is validating – like it does with HTML5 validation.
   That way, you are following the standard, and at the same time, your don’t have
   to make up a value or ask the Formello user to set one, because a value is not
   necessary.
 * For reference:
 * [https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/checkbox#value](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/checkbox#value)
 * [https://www.w3.org/TR/2011/WD-html5-20110405/common-input-element-attributes.html#dom-input-value-default-on](https://www.w3.org/TR/2011/WD-html5-20110405/common-input-element-attributes.html#dom-input-value-default-on)

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘checkbox not validating’ is closed to new replies.

 * ![](https://ps.w.org/formello/assets/icon-256x256.png?rev=2488085)
 * [Contact form builder for Gutenberg - Formello](https://wordpress.org/plugins/formello/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/formello/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/formello/)
 * [Active Topics](https://wordpress.org/support/plugin/formello/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/formello/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/formello/reviews/)

 * 10 replies
 * 2 participants
 * Last reply from: [dschmidtke](https://wordpress.org/support/users/dschmidtke/)
 * Last activity: [2 years, 5 months ago](https://wordpress.org/support/topic/checkbox-not-validating/#post-17270458)
 * Status: resolved