HTML_QuickForm2: value of unchecked checkbox
| From: | Christian Weiske | Date: | Tue, 01 Jun 2010 20:38:11 +0000 |
| Subject: | HTML_QuickForm2: value of unchecked checkbox | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-53524@lists.php.net to get a copy of this message | ||
Hi all and Alexey,
HTML forms always had the problem that checkboxes get not submitted
when they are not checked. This leads to E_NOTICEs in the best or
program errors in the worst case if this cases are not checked properly.
I think QF2 should make programming with forms easy, and that means
that the value of a checkbox should be either boolean true or false -
no matter what the HTML form specifics say.
This could be solved in two ways:
1) adding a hidden field before the checkbox, with the same name and
value of "0"
2) programmatically fix the value when using getValue().
Thoughts?
--
Regards/Mit freundlichen Grüßen
Christian Weiske
-=≡ Geeking around in the name of science since 1982 ≡=-
Attachment: [application/pgp-signature] signature.asc
Attachment: [application/pgp-signature] signature.asc