views:

182

answers:

2

Hi,

I want my own form element based on Zend_Form_Element_File. My Problem: the custom view helper I created is never run. Instead, always the FormFile Viewhelper is run. When I inherit from Zend_Form_Element_Xhtml, my custom view helper works.

Does not work:

class XY_Model_Form_Imageu extends Zend_Form_Element_File
{
  public $helper = "imageUpload";
}

Does work, but I don't want to do the file upload on my own:

class XY_Model_Form_Imageu extends Zend_Form_Element_Xhtml
{
  public $helper = "imageUpload";
}

Any ideas? I'm using ZF 1.10.

EDIT: It seems like if it's this issue: http://framework.zend.com/issues/browse/ZF-8136

Does anybody has a fix?

A: 

I had the same problem and the workaround was that I created custom decorator which I used in the extended file element.

The decorator's render() has been overloaded to use the view helper I needed.
The view helper's function is hardcoded in the decorator as the bug report says, which is a shame...

michal kralik
A: 

My post might help you. I found the element difficult to work with as well.

Sonny