Hi,
The intention is to create a custom message template for missing input
values for Zend_Filter_Input. I would hope to set the 'notEmptyMessage'
meta attribute in the $options array getting fed to Zend_Filter_Input.
I thought the meta attribute would have allowed me to create default
messages for every missing input value, but it did not work, I kept
receiving default messages from some validators.
Some validator types (Digits, Alnum) have a notEmpty validator whose
message is used instead of the notEmptyMessage message template I
defined in the options array.
After a few hours of puzzlement, I checked the bugs affecting
Zend_Filter_Input and yes there is a bug report for it.
I should have checked the outstanding bugs, something I will remember to
do next time because I did spend a chunk of time wondering if I was
doing something wrong.
The bug: http://framework.zend.com/issues/browse/ZF-1912
The workaround is to set each message type manually, a bit of pain and
extra code but the fix in the Zend framework should be coming soon I hope.
// Works.
$validators = array(
'month' => array(
'Digits',
array('Between', array(1, 12)),
'messages' => array(
array( Zend_Validate_Digits::STRING_EMPTY => "A month
value is required", Zend_Validate_Digits::NOT_DIGITS => "Month must only
consist of numbers or letters" ),
'Month must be between 1 and 12'
)
)
);
Thanks.
Paul
Lepidosteus wrote:
I did not fully understand what you are trying to achieve here ?
Do you try without success to change an error message ? To allow an
empty value ? To disallow an empty value ?