开发者

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

开发者 https://www.devze.com 2023-01-10 04:59 出处:网络
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.

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
0

精彩评论

暂无评论...
验证码 换一张
取 消