Zend Framework

Zend_Form_Element_File does not translate error message when translator is set at the form level

Details

  • Type: Improvement Improvement
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.7.0
  • Fix Version/s: 1.7.1
  • Labels:
    None

Description

There was a similar ticket opened which was marked as resolved (ZF-4150), but I am still having the error in ZF 1.7

When setting a translator at the form level, the error messages are all translated for all elements except for the File element

Code to reproduce error, submit the form without selecting a file and you will see the error message remains un-translated:

$form = new Zend_Form();

$translate = new Zend_Translate('array', array(
    Zend_Validate_File_Upload::NO_FILE => 'Test translation',
), 'en');
Zend_Form::setDefaultTranslator($translate);

$form->setAttrib('enctype', 'multipart/form-data');

$form->addElement('file', 'upload', array(
    'label' => 'Upload',
    'required' => true
));

$form->addElement('submit', 'save', array(
    'label' => 'Upload'
));

if ($this->getRequest()->isPost() && $form->isValid($_POST)) {
    // process form
}

$this->view->form = $form;

Activity

Hide
Thomas Weidner added a comment -

Feature only integrated at adapter and validator level for now.

Show
Thomas Weidner added a comment - Feature only integrated at adapter and validator level for now.
Hide
Thomas Weidner added a comment -

Feature added with r12728

Show
Thomas Weidner added a comment - Feature added with r12728

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: