I have a problem with changing messages for StringLength in Zend_Filter_Input. Code:
$filters = array(
'nazwa' => 'StringTrim',
'haslo' => 'StringTrim'
);
$validators = array(
'nazwa' => array(
'allowEmpty' => false,
'presence' => 'required',
new Zend_Validate_StringLength(array('min' => 5, 'max' => 30)),
array('Regex', array('pattern' => '/^[\w]+$/'))
),
'haslo' => array(
'allowEmpty' => false,
'presence' => 'required',
new Zend_Validate_StringLength(array('min' => 5, 'max' => 30))
)
);
$data = array(
'nazwa' => $formData['nazwa'],
'haslo' => $formData['haslo']
);
$options = array(
'notEmptyMessage' => "Pole '%field%' jest wymagane"
);
$input = new Zend_Filter_Input($filters, $validators, $data, $options);
I think I just tried everything from translating, adding options, messages in $validators and it is still default message. Please let me know how to change those default error messages (like TOO_SHORT, TOO_LONG) for new ones.