I can use the following method to override all the error messages of a zend form element.
$name->setRequired( TRUE )
->setAttrib( 'id', 'fullname' )
->addErrorMessage( 'Please provide your name' );
However, I cannot replicate this when I am creating a form element using the factory pattern.
The 'errorMessage' key does nothing.
$this->addElement('text', 'city', array(
'placeholder' => 'City*',
'required' => true,
'filters' => array('StringTrim', 'StripTags'),
'errorMessage' => 'TEST',
'validators' => array(
array('StringLength', false,
array(3, 50,
/*'messages' => array(
Zend_Validate_StringLength::TOO_SHORT => 'too short'
)*/
)
)
),
'decorators' => array('ViewHelper','Errors'),
));
I can override each Zend error message individually(see commented out code) but that is a very tedious process.
Is there a way to override all error messages when creating ZF form element using the factory pattern?