2010-08-05 60 views
2

我試過了我能想到的所有東西,我無法弄清楚如何在Zend_Form_Element_File上只顯示ViewHelper修飾符。Zend Framework:如何刪除Zend_Form_Element_File上的DtDd裝飾器?

$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); 
在我看來腳本

echo $this->form->UserPhoto 

產生

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

這就是我想要的:

input element 

回答

2

最短的形式是:

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

謝謝!我試圖使用'ViewHelper'而不是'File'。不知道爲什麼File元素沒有'ViewHelper'。 =/ – Andrew 2010-08-11 18:10:51

+0

非常感謝您的回答。謝謝。 – 2014-01-12 18:09:16

2

這是我能得到它的唯一途徑上班:

$this->addElement($UserPhoto, 'UserPhoto'); 
$this->UserPhoto->removeDecorator('label'); 
$this->UserPhoto->removeDecorator('htmlTag'); //DtDd