Issues

ZF-11476: Zend_Form::getMessages for a sub form returns an array, causing Zend_Form_Decorator_Errors to think it has errors

Issue Type: Bug Created: 2011-06-13T15:26:38.000+0000 Last Updated: 2013-02-12T14:09:28.000+0000 Status: Resolved Fix version(s): - 1.12.2 (25/Feb/13)

Reporter: Marc Lester (marclester) Assignee: Frank Brückner (frosch) Tags: - Zend_Form

Related issues: - ZF-11494

Attachments:

Description

Zend_Form::getMessages for a sub form returns an array, causing Zend_Form_Decorator_Errors to think it has errors. If you create a sub form and add the error decorator to it, the getMessages() function return array('subformname' => ) which Zend_Form_Decorator_Errors interprets as an error

Comments

Posted by Nikolay Petrovski (npetrovski) on 2011-06-21T12:26:22.000+0000

same as: http://framework.zend.com/issues/browse/ZF-11494

Posted by Emilio (nicoliky) on 2013-02-12T11:27:42.000+0000

This is a little hack that works for me

class MySubForm Date extends Zend_Form_Subform { ... public function getMessages($name = null, $suppressArrayNotation = false) { $messages = parent::getMessages($name, $suppressArrayNotation); return !isset($messages[$this->getName()]) ? $messages : null; } ... }

Posted by Frank Brückner (frosch) on 2013-02-12T13:19:35.000+0000

@Emilio Thanks for your proposal, but your code does not work: Test Zend_Form_FormTest::testGetMessagesWithElementsBelongTo() failed! (Test class)

Posted by Frank Brückner (frosch) on 2013-02-12T14:09:28.000+0000

Fixed on trunk (25252) and release-1.12 (25253)

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