So I am using Zend and I have a Zend form with a Zend_Form_Element_File and three validators: 1. setRequired 2. Extension 3. Size
$this->browse = new Zend_Form_Element_File('Browse');
$this->browse->setRequired(false)->removeDecorator('errors')->removeDecorator('label')
->addValidator('Extension', true, 'pdf')->addValidator('Size', false, 2000000);
I want to set custom error messages for these validators but do not know how.
The reason I want to set a custom error message is because I have a custom decorator with which I grab all errors when the form is not valid with isValid() and display them at the top of the form. The method for which I am grabbing errors in the form is getErrors().
I've also tried: http://www.mail-archive.com/[email protected]/msg25779.html by doing:
$validator = new Zend_Validate_File_Upload();
$validator->setMessages(array('fileUploadErrorNoFile' => 'Upload an image!''));
and doing
$this->browse->addValidator($validator);
Any help?