Zend File Upload and Element Decorators

The File element requires it’s own decorator – Zend_Form_Decorator_File. $this->setElementDecorators(array( ‘File’, ‘Errors’, array(array(‘data’ => ‘HtmlTag’), array(‘tag’ => ‘td’)), array(‘Label’, array(‘tag’ => ‘th’)), array(array(‘row’ => ‘HtmlTag’), array(‘tag’ => ‘tr’)) )); [edit] Have just noticed that you are also using other form elements. After your original code, add: $this->getElement(‘Excel’)->setDecorators( array( ‘File’, ‘Errors’, array(array(‘data’ => ‘HtmlTag’), array(‘tag’ => … Read more

How do I use ViewScripts on Zend_Form File Elements?

The answer is relatively simple as it happens. All you need do is specify the File decorator first, create a specific view script for the file input and specify false for the placement in the viewScript decorator arguments, this will effectively inject the output from the File decorator into the viewScript decorator e.g. $element->setDecorators(array(‘File’, array(‘ViewScript’, … Read more

Add some html to Zend Forms

The only way I can think of at the moment is to add a dummy element to the form and remove all decorators except an ‘HtmlTag’ with the attributes you specified in your question. Removing the decorators means that the actual element will not be rendered – only the HtmlTag decorator will be rendered. so … Read more