I could use some help figuring out how to override the default validation
error messages with my own. Consider this snippet, based on the example in
the docs:
$validators = array(
'month' => array(
'NotEmpty',
'Digits',
'messages' => array(
0 =>'my custom message: this is empty',
1=>'my custom message: this ain\'t digits!'),
)
);
$input = new Zend_Filter_Input(null,$validators,
array(
'month'=>''
)
);
if ($input->isValid()) {
echo "input is valid\n" ;
} else {
print_r($input->getMessages());
}
Output when I run this in 1.7.8:
Array
(
[month] => Array
(
[isEmpty] => my custom message: this is empty yo
[stringEmpty] => '' is an empty string
)
)
Output when I run this in 1.9.0: (undesired):
Array
(
[month] => Array
(
[isEmpty] => You must give a non-empty value for field 'month'
)
)
I am having this problem with several Zend validation classes, not just
Zend_Validate_NotEmpty. Any help is much appreciated.
--
David Mintz
http://davidmintz.org/
The subtle source is clear and bright
The tributary streams flow through the darkness