ZF-6355: Zend_Form_Element_File does not render attributes
Description
$image = $this->createElement('file', 'image'); $image ->setLabel('Image') ->setAttrib('class', 'myClass') $this->addElement($image);
The class attribute does not get rendered, seems to be because of line 53 in Zend/View/Helper/FormFile.php
public function formFile($name, $attribs = null) which should be public function formFile($name, $value = null, $attribs = null)
Comments
Posted by Thomas Weidner (thomas) on 2009-04-23T14:54:02.000+0000
No, because a file element does not have a value. And the file decorator does call formFile with 2 params, where the second is an array of attributes for this file element.
Posted by Thomas Weidner (thomas) on 2009-04-23T15:02:08.000+0000
I can not verify your results... Using setLabel and setAttrib calls I get the image and also the class rendered.
Posted by Jasper van Putten (jasper) on 2009-04-23T23:16:38.000+0000
You are correct, It's because I removed the decorator in my code so the attributes were not set properly.