Hi!

Ho to add custom validation messages in Zend_From?

For instance in standard method (without Zend_Form) I can do:

$validators = array(
  'login' => array(
    new Zend_Validate_NotEmpty(),
    'messages' => array(
      array(
       // here is my custom message
       Zend_Validate_NotEmpty::IS_EMPTY => 'Proszę podać login'
      )
    )
  )....

$inputFilter = new Zend_Filter_Input($filters, $validators);
$inputFilter->setDefaultEscapeFilter(new Zend_Filter_StringTrim());
$inputFilter->setData($data);

if ($inputFilter->isValid()) {...

This method works very good for me, but how to add custom validation
messages, for example in this part of code:
http://framework.zend.com/manual/en/zend.form.elements.html#zend.form.elements.validators?

I suppose that I should use $options variable (from method
Zend_Form_Element<http://framework.zend.com/apidoc/core/Zend_Form/Element/Zend_Form_Element.html>
addValidator
(string|Zend_Validate_Interface<http://framework.zend.com/apidoc/core/Zend_Validate/Zend_Validate_Interface.html>
 $validator, [bool $breakChainOnFailure = false], [array $options = array()])
), but how?

Reply via email to