1

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?

Charles
  • 50,943
  • 13
  • 104
  • 142
foster
  • 33
  • 1
  • 5

1 Answers1

0

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...

mike
  • 5,047
  • 2
  • 26
  • 32
  • You should look at my post that I linked to. It turns out it wasn't so hard to do once I knew about the `'placement' => false` option. – Sonny Nov 18 '10 at 20:33