Search code examples
zend-frameworkzend-form-elementzend-decorators

Zend Framework: How to remove the DtDd Decorator on a Zend_Form_Element_File?


I've tried every thing I can think of and I can't figure out how to display only the ViewHelper decorator on a Zend_Form_Element_File.

$UserPhoto = new Zend_Form_Element_File('UserPhoto');
$UserPhoto->setDestination(TMP_DIR);
$UserPhoto->addValidator('Count', false, 1);
$UserPhoto->addValidator('Size', false, 10240000); // 10 mb max
$this->addElement($UserPhoto);

in my view script:

echo $this->form->UserPhoto

Which generates

<dt>label</dt>
<dd>input element</dd>

This is what I want:

input element

Solution

  • The shortest form is:

    $UserPhoto->setDecorators(array('File'))