Issues

ZF-3026: Bug with checked attribute in FormCheckbox helper.

Issue Type: Bug Created: 2008-04-02T11:18:48.000+0000 Last Updated: 2008-05-05T11:44:48.000+0000 Status: Resolved Fix version(s): - 1.5.2 (15/May/08)

Reporter: Tom Holder (tholder) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_View

Related issues: - ZF-3008

Attachments:

Description

The logic for 'checking' a checkbox does not fit with the documentation. The documentation states:

formCheckbox($name, $value, $attribs): Creates an element. If $value matches the "checked" value, the box will be checked for you.

However, if you use the logic:

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.

Comments

Posted by Wil Sinclair (wil) on 2008-04-18T16:03:38.000+0000

Please evaluate and categorize/assign as necessary.

Posted by Matthew Weier O'Phinney (matthew) on 2008-04-22T10:50:48.000+0000

Scheduling for next mini release.

Posted by Matthew Weier O'Phinney (matthew) on 2008-05-02T12:15:49.000+0000

Resolved with ZF-3149

Have you found an issue?

See the Overview section for more details.

Copyright

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

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

Contacts