I have a Zend_Form_element:
$text=new Zend_Form_Element_Text('text');
I added a regex validator to it:
$text->addValidator('regex', false, array('/[\\?\\&]v=([^\\?\\&]+)/'));
How could I set a customized error message for the validator?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can add custom validation error messages if you know what specific error codes the validator provides. In case of regex, I believe it gives an “regexNotMatch” error, so for this particular case, you could use:
For more information, have a look here.
Similar question here and here