Issues

ZF-11088: Zend_Form addError() is not working correctly

Issue Type: Bug Created: 2011-02-18T06:03:26.000+0000 Last Updated: 2011-02-19T09:54:10.000+0000 Status: Resolved Fix version(s): Reporter: aurorius (aurorius) Assignee: Michelangelo van Dam (dragonbe) Tags: - Zend_Form

Related issues: - ZF-5150

Attachments:

Description

<pre class="literal">
$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.

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