• Thanks for this great post. But hey, why don’t you simply call the Zend_Form_Element::setErrorMessages() method?
    http://framework.zend.com/apidoc/core/Zend_Form/Element/Zend_Form_Element.html#methodsetErrorMessages

    simple as that:

  • This is a very simplified example and your suggestion works in this particular context. But keep in mind that setErrorMessages() overrides the messages for all validators. I just want to show the same message – Please enter a correct email – only if the email is invalid. If the email already exists in the database, I want to display another message using Zend_Validate_Db_NoRecordExists.

  • Thanks for the trick.
    I just don’t understand why there is not a way to remove these unwanted messages about DNS, etc.
    90% of the users won’t even understand it.

  • I don’t know, but the messages are too technical for the average user.

  • Hello, thanks for solution. Great idea!

    Also you can create your custom validator where will be called Zend_Validate_EmailAddress, for ex.

  • another variant using parent::

  • Eebs

    Excellent write up, I was having exactly the same problem, great flexible fix. I can now still have default error messages for other validators, but now the EmailAddress validator doesn’t spew out several cryptic errors.

    Thanks!

  • Seniore T

    Thank you very much!
    Especially ‘Endi’ for his posting!

  • Anatoly

Advertisment ad adsense adlogger