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

Issue Type: Improvement Created: 2007-11-23T19:19:13.000+0000 Last Updated: 2008-02-26T12:56:02.000+0000 Status: Resolved Fix version(s): - 1.0.4 (26/Feb/08)

Reporter: Michal Vrchota (techi) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_View

Related issues: - ZF-1666



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]); }


Posted by Darby Felton (darby) on 2007-11-30T08:52:53.000+0000

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

Posted by Matthew Weier O'Phinney (matthew) on 2008-02-13T08:37:38.000+0000

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).

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.