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($Us开发者_高级运维erPhoto);
in my view script:
echo $this->form->UserPhoto
Which generates
<dt>label</dt>
<dd>input element</dd>
This is what I want:
input element
The shortest form is:
$UserPhoto->setDecorators(array('File'))
This was the only way I could get it to work:
$this->addElement($UserPhoto, 'UserPhoto');
$this->UserPhoto->removeDecorator('label');
$this->UserPhoto->removeDecorator('htmlTag'); //DtDd
精彩评论