So, I use Zend, and I have a Zend form with 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 install custom error messages for these validators, but I donβt know how to do it.
The reason I want to set my own error message is because I have my own decorator with which I get all errors when the form is invalid with isValid () and displays them at the top of the form. The method for which I take errors in the form is getErrors ().
I also tried: http://www.mail-archive.com/ fw-general@lists.zend.com /msg25779.html doing:
$validator = new Zend_Validate_File_Upload(); $validator->setMessages(array('fileUploadErrorNoFile' => 'Upload an image!''));
and making
$this->browse->addValidator($validator);
Any help?
source share