I am experimenting with the Zend_Validate_Between class.
I set it up thusly:
$scoreBetweenValidator = new Zend_Validate_Between(-3, 3, true);
so the validator should only accept values between -3 and 3, inclusive.
On an invalid value I got a '%value%' was not found in the haystack error message, which I think belongs to the Zend_Validate_InArray class (Zend_Validate_InArray::NOT_IN_ARRAY).
My problem is that I wish to use custom error messages with the setMessages method, but I don't know how I could set it up for this seemingly foreign message key.
I tried this:
$scoreBetweenValidator->setMessages(array(
Zend_Validate_Between::NOT_BETWEEN_STRICT => 'my custom msg',
Zend_Validate_Between::NOT_BETWEEN => 'my other custom msg',
//'notInArray' => "doesn't work"
//Zend_Validate_InArray::NOT_IN_ARRAY => "also doesn't work"
));
but I got a No message template exists for key 'notInArray' exception.
What is the preferred solution for setting custom validation messages in Zend Framework?
As a reply to Jason:
A Zend_Form_Element_Select is inside a Zend_Form class attached with addElements method.
The form doesn't have any other elements just this one, and it doesn't have any other validators, just the Between.
The select's options are all valid by default, but when I tweak the option value (with Firebug) and set an invalid value (as a self-hacking attempt) I receive the notInArray exception.