ZF-11476: Zend_Form::getMessages for a sub form returns an array, causing Zend_Form_Decorator_Errors to think it has errors
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)