views:

177

answers:

3

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
A: 

This was the only way I could get it to work:

$this->addElement($UserPhoto, 'UserPhoto');
$this->UserPhoto->removeDecorator('label');
$this->UserPhoto->removeDecorator('htmlTag'); //DtDd
Andrew
+1  A: 

The shortest form is:

$UserPhoto->setDecorators(array('File'))
Ololo
Thank you! I was trying to use 'ViewHelper' instead of 'File'. Not sure why there is no 'ViewHelper' for a File element. =/
Andrew
A: 

This is the perfect solution i was wishing for last one week. This one worked for me after using htmlTag removeDecorator; Thanks

Aqeel