Title: Invalid returned HTML with multiple required checkboxes
Last modified: August 30, 2016

---

# Invalid returned HTML with multiple required checkboxes

 *  Resolved [imagospot](https://wordpress.org/support/users/imagospot/)
 * (@imagospot)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/invalid-returned-html-with-multiple-required-checkboxes/)
 * Hello,
 * in version 2.4.0 and 2.4.1 there is bug with processing multiple required checkboxes.
 * in simplr_build_form function in simplr_form_functions.php at 369 line:
 *     ```
       if(isset($data[$cf['key']])) {
       ...
       $key_val = $data[$cf['key']];
       }
       ```
   
 * you are checking if value is posted and present in dictionary, but you don’t 
   reset value of $key_val between multiple fields, that means if you check on checkbox
   all next checkboxes will be returned with invalid markup after validation.
 * Proposed change:
    Add
 *     ```
       else {
          $key_val = '';
       }
       ```
   
 * Or
    Create checkboxes with another hidden field.
 *     ```
       <input type="hidden" name="test" val="">
       <inputy type="checkbox" name="test" val="on">
       ```
   
 * This ensures that there is always posted value, even if checkbox is not checked.
   Because browsers doesn’t send value for unchecked fields.
 * Proof screenshots:
    [http://i.imgur.com/TdcDUBc.png](http://i.imgur.com/TdcDUBc.png)
   [http://i.imgur.com/xKMoct6.png](http://i.imgur.com/xKMoct6.png) – checked only
   first field, returned form has all checkboxes checked [http://i.imgur.com/xbNmT8U.png](http://i.imgur.com/xbNmT8U.png)–
   checked only second field, returned form has all next checkboxes checked

Viewing 1 replies (of 1 total)

 *  [Marcel Pol](https://wordpress.org/support/users/mpol/)
 * (@mpol)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/invalid-returned-html-with-multiple-required-checkboxes/#post-6773649)
 * Thank you.
    It is fixed in 2.4.2.

Viewing 1 replies (of 1 total)

The topic ‘Invalid returned HTML with multiple required checkboxes’ is closed to
new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/simplr-registration-form_be8c38.svg)
 * [Simplr Registration Form Plus+](https://wordpress.org/plugins/simplr-registration-form/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/simplr-registration-form/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/simplr-registration-form/)
 * [Active Topics](https://wordpress.org/support/plugin/simplr-registration-form/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/simplr-registration-form/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/simplr-registration-form/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Marcel Pol](https://wordpress.org/support/users/mpol/)
 * Last activity: [10 years, 6 months ago](https://wordpress.org/support/topic/invalid-returned-html-with-multiple-required-checkboxes/#post-6773649)
 * Status: resolved