ZF-2230: View helper for checkbox is not compatible with array


Zend_View_Helper_FormCheckbox should NOT render hidden element with "0" value when the name of the checkbox is array-like variable such as

$this->formCheckbox('languages[]', ...

Because programmer usually needs submit only those items, which are checked and not fill the array with zeros

I vote to modify the code something like that

$is_array = substr($name, -2) == '[]'; if (!$is_array) { $xhtml .= $this->_hidden($name, $options[1]); }


Assigning to [~matthew] and marking to fix for 1.1.0 or next mini release.

Resolved in trunk. The 'options' argument now is no longer used; simply provide a true value to the 'checked' attribute, and the checkbox will be checked appropriately (a false value will leave it unchecked).