ZF-11088: Zend_Form addError() is not working correctly
Description
$form->getElement('nobaru')->addError('My custom error');
if ($form->isValid($this->getRequest()->getPost())) {
// OK
} else {
// Should not be empty array
$zf = $form->getMessages();
}
getMessages() will return empty array even though the element has been marked as failed, however, the custom error message will be displayed if the element failed another validation defined when creating the element in another class extended from Zend_Form
Comments
Posted by aurorius (aurorius) on 2011-02-18T06:05:27.000+0000
I don't think the previous issue has been fixed, so, I'm opening new issue for the problem
Posted by Michelangelo van Dam (dragonbe) on 2011-02-19T09:54:09.000+0000
This issue is a non-issue since custom error messages should be retrieved using $form->getErrorMessages().
The only moment $form->getMessages() returns the custom error message is exactly when validation failures occur, which is indeed the case.