Zend_Form_Element_Exception

After upgrading to Zend Framework 1.8 earlier this week we’ve had a few more minor glitches that have surfaced since. The one which took me some time to figure out was 'Zend_Form_Element_Exception' with message 'No file decorator found... unable to render file element' To ease the generation of forms and get them all to look the same we use a class named Form_Static_Render that the Zend_Form gets pushed into and which takes care of styling, decorators, preview pages and display of form errors. It’s quite a clever little thing. To achieve the proper styling our extension to Zend_Form calls

$element->clearDecorators();

and then either adds the default ViewHelper or whatever gets passed to the method and that was the root of the problem. When clearing the decorators, Zend_Form_Element_File now explicitly requires you to add the File Decorator again before rendering. After discovering that, it turned out being a quick fix…

Published on May 28, 2009 at 1:32 pm by Jan Gorman.
Filed under: Code, Hint Tags:, , , , | 1 Comment


Zend_Form decorator

Since Matthew Weier O’Phinney can explain this a lot better than I ever could, I’ll simply refer you to his excellent post about Zend_Form decorators, well worth a read.

Published on Apr 06, 2009 at 8:05 am by Jan Gorman.
Filed under: Code, Hint Tags:, , , , , | No Comments