Issues

ZF-9419: Zend_Form_Decorator_ViewHelper::getValue ignores values set via Zend_Form_Element_Button::setValue

Issue Type: Bug Created: 2010-03-12T12:43:48.000+0000 Last Updated: 2010-04-05T03:01:54.000+0000 Status: Closed Fix version(s): Reporter: Christopher Verwymeren (cverwymeren) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_Form

Related issues: - ZF-5056

Attachments:

Description

Setting a value on a Zend_Form_Element_Button object using setValue does not result in a "value" name/value pair being included as an attribute in the rendered button tag. The getValue method in Zend_Form_Decorator_ViewHelper returns null when a Zend_Form_Element_Button element is detected.

As documented at http://www.w3schools.com/tags/tag_button.asp the button tag can has a "value" attribute that can be used to assign a value to a button independent of the label used.

This issue also occurs when attempting to set a "value" attribute using the setAttrib method of Zend_Form_Element_Button.

Comments

Posted by Thomas Weidner (thomas) on 2010-03-15T11:11:13.000+0000

Assigned component

Posted by Christian Albrecht (alab) on 2010-03-15T14:04:45.000+0000

Thomas please could you reassign this to Zend_View as the button is rendered in Zend_View_Helper_FormButton::formButton(), i am not able to reassign Issues yet.

Posted by Christian Albrecht (alab) on 2010-03-15T14:08:06.000+0000

This is simply adding the attribute value to the rendered attributes. The Zend_Form_Element_Button has no method setValue() this method is inherited from Zend_Form_Element which means the Value is set, but gets not rendered.

Posted by Marc Bennewitz (GIATA mbH) (mben) on 2010-03-26T02:33:52.000+0000

The problem is on Zend_Form_Decorator_ViewHelper::getValue:

<pre class="highlight">
if (!$element instanceof Zend_Form_Element) {
    return null;
}

foreach ($this->_buttonTypes as $type) {
    if ($element instanceof $type) {
        if (stristr($type, 'button')) {
            $element->content = $element->getLabel();
            return null;
        }
        return $element->getLabel();
    }
}

return $element->getValue();

This means on button elements the label is the same as the value.

-> The ViewHelper decorator shouldn't handle differences of value/label. This should be done on view helper.

Posted by Christian Albrecht (alab) on 2010-04-05T03:01:53.000+0000

Closing as duplicate of ZF-5056, because that one contains a possible solution.

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