I would like to set different error messages for validators in a Zend_Form.

I understand (and tried) the two approaches :

  1. using Zend_Translate passed to the form
  2. using 'messages' array passed to the validators for each elements

The problem with Zend_Translate is that I can not set two different messages for a same key. For instance, I would like to set different Zend_Validate_NotEmpty::IS_EMPTY message for two different elements in the form. The other problem with #2 is that I can't set messages of a validators used in the validators of the form element ; example : the Zend_Validate_EmailAddress is using the Zend_Validate_Hostname... I can redefine the Zend_Validate_EmailAddress messages, but I can't do it for the Zend_Validate_Hostname messages : when I try I get this error : No message template exists for key 'hostnameIpAddressNotAllowed'

What is the good way to redefine all validators errors messages independently on each form elements ?

Thank you!

--
Jérémy



--
Jérémy Lajotte
01 75 75 03 97
02 54 77 75 27
09 50 15 65 00
06 74 07 1000

Reply via email to