2011-03-14 30 views
2

我想刪除只有一個字段的zend形式的dt標籤。請讓我知道我該怎麼做。下面是我想和沒有得到dt標籤移除代碼:提前如何刪除特定字段的zend形式的dt標籤

$day = new Zend_Form_Element_Multiselect('day','day'); 
$day->setLabel('') 
    ->removeDecorator('DtDdWrapper') 
    ->setOptions(array('class' => 'width100')) 
    ->addMultiOptions(array('Select Type' => '',)) 
    ->addMultiOptions($day_of_month); 

感謝。

回答

1

要調試使用:Zend_Debug::dump(get_class_methods($day));,我們現在擁有的,我們可以使用方法列表中,一個能幫助我們在這種情況下會getDecorators(),所以:Zend_Debug::dump($day->getDecorators());

我們將看到,Zend_Form_Decorator_Label有標籤dt你想要移除的女巫。

鑑於裝飾者的名字我們可以這樣做:$day->removeDecorator('Label');並且看到dt裝飾者已經離開建築物。

+0

當我回應Zend_Debug ::轉儲($ day-> getDecorators());我得到了以下內容,請讓我知道我可以在下一步去除dt標籤:[「Zend_Form_Decorator_Label」] => object(Zend_Form_Decorator_Label)#438(5){「_placement」:protected] => string(7 )「PREPEND」 [「_tag」:protected] => NULL [「_element」:protected] => NULL [「_options」:protected] => array(1){ [「tag」] => string (2)「dt」 } [「_separator」:protected] => string(2)「 」 – Lakshman 2011-03-14 15:33:05

+0

$ day-> removeDecorator('Label');並看到dt裝飾者已離開大樓。 – 2011-03-14 15:34:29

+0

它工作的兄弟,thanx很多。 – Lakshman 2011-03-14 15:39:55