Wednesday, 17 October 2012

Why can't Zend_Form render my File element without errors? | Zend Framework Interview Questions

The file element needs a special file decorator, which is added by default. When you set your own decorators for file elements, you delete the default decorators.
For example:
$element->setDecorators(array(
    array('ViewHelper'),
    array('Errors')
));

You should use a File decorator instead of the ViewHelper for the file element, like so:
$element->setDecorators(array(
    array('File'),
    array('Errors')
));

No comments: