Details
Description
The logic for 'checking' a checkbox does not fit with the documentation. The documentation states:
formCheckbox($name, $value, $attribs): Creates an <input type="checkbox" /> element. If $value matches the "checked" value, the box will be checked for you.
However, if you use the logic:
<?=$this->FormCheckbox('FieldName', 'true', array('checked' => $this->GetParam('FieldName')))?>
It won't check the field on postback.
I have amended my code inside the Zend helper to the following:
if (isset($attribs['checked']) && $attribs['checked'] == $value) { $checked = ' checked="checked"'; unset($attribs['checked']); } else { unset($attribs['checked']); }
This has resolved the issue for me. Hope this is helpful.
Issue Links
| This issue is related to: | ||||
| ZF-3008 | formCheckbox() helper documentation is out of date |
|
|
|
Please evaluate and categorize/assign as necessary.