jaxon-php / jaxon-core

The Jaxon core library
https://www.jaxon-php.org
BSD 3-Clause "New" or "Revised" License
65 stars 28 forks source link

Why getFormValues don't return unchecked checkboxes? #19

Closed jatubio closed 7 years ago

jatubio commented 7 years ago

When I want to validate if a checkbox has been marked on a form, it is impossible for me because getFormValues does not return that unchecked checkboxes and my code only validates the fields that come from that function.

I know how to fix it because I already had to modify that part of the javascript code in xajax. But, apart from not be recommendable for possible changes in future updates, I'm curious to know why those fields are not returned?

Thanks

feuzeu commented 7 years ago

Hi, Unchecked checkboxes are not included in form values in order to conform to the HTML standard. https://www.w3.org/TR/html401/interact/forms.html#h-17.13.2. You'd rather handle that in your PHP application, since you will have the same behavior when processing any standard POST query. Regards

jatubio commented 7 years ago

Thanks for the clarification