php - Zend_Form: how to remove multiple <legend> elements in fieldset (nested DIV) -


i want this:

<div class="widgetbox">     <legend class="widgettitle">widget box</legend>     <div class="widgetcontent"> content goes here... </div> </div> 

my code this:

$this->adddisplaygroup(         $fields,         'main',         array(             'legend' => $this->_tlabel.'group_main',             'decorators' => array(                 'formelements',                 array(                     array('widgetcontent'=>'htmltag'), array('tag'=>'div', 'class'=>'widgetcontent')                     ),                 array('htmltag',array('tag' => 'div',  'class' => 'widgetbox')),             )         )     ); 

and can is:

<div class="widgetbox">   <legend>main info</legend>     <div class="widgetcontent">       <legend>main info</legend>     </div> </div> 

as can see double legend elements, want 1 - first on, right after div.widgetbox.

can me remove unneeded legend element nested div?

thanks!

you can use h4 instead, not legend. try:

$this->adddisplaygroup(     $fields,     'main',     array(         'description' => 'widget title',         'decorators' => array(             'formelements',             array(array('widgetcontent' => 'htmltag'), array('tag'=>'div', 'class'=>'widgetcontent')),             array('description', array('tag' => 'h4', 'placement' => 'prepend', 'class' => 'widgettitle')),             array(array('widgetbox' => 'htmltag'), array('tag' => 'div',  'class' => 'widgetbox'))         )     ) ); 

this adds description decorator , sets tag <h4>. aliased widgetbox decorator make clearer how fits together. gives me:

<div class="widgetbox">     <h4 class="widgettitle">widget title</h4>     <div class="widgetcontent">...</div> </div> 

like said in comment, since code doesn't include fieldset decorator, don't see how you've posted include legends @ all, seems there's elsewhere in app that's changing decorators after runs. if you're still getting legends, need try , figure out being added.


Comments