cakephp: Checkbox doesn't allow value of 0
The checkbox defaults to 1 if you try to set the value to 0.
echo $this->Form->checkbox('published', array(
'value' => '0',
'hiddenField' => 'anything',
));
About this issue
- Original URL
- State: closed
- Created 10 years ago
- Comments: 18 (13 by maintainers)
Yep, but I don’t think that FormHelper should magically swap one field depending on the other.
I’m confused. I am trying to submit a checkbox with a zero value when checked?
If I change the empty on: https://github.com/cakephp/cakephp/blob/master/lib/Cake/View/Helper/FormHelper.php#L1410
To a !isset it works as I expect it.