Issues

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

I don't think the previous issue has been fixed, so, I'm opening new issue for the problem

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.