2011-03-14 29 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