Zend Form Group Decorators

I'm trying to understand how to remove a shortcut from a display group, when you look at the markup below you will see that there is a dt with the id id and the next dd, I want to remove them, but keep the set of fields.

To add a display group, I use this $this->addDisplayGroup(array(...), 'legend' => 'address'); inside my init init class after adding each of the elements. Are there some decorators I can play with to remove an item that I don't want?

 <form id="CreateAddress" enctype="application/x-www-form-urlencoded" action="" method="post"> <dl class="zend_form"> <dt id="address-label">&#160;</dt> <dd id="address-element"> <fieldset id="fieldset-address"> <legend>Address</legend> <dl> <dt id="addressLine1-label"> <label for="addressLine1" class="required">Address Line 1</label> </dt> <dd id="addressLine1-element"> <input type="text" name="addressLine1" id="addressLine1" value=""> </dd> ...etc... </fieldset> </dd> ...buttons... </dl> </form> 

Thanks,
Martin

+4
source share
4 answers

So what is the deal?

 $group = $form->getDisplayGroup ('the name of the group'); $group->removeDecorator ('Zend_Form_Decorator_DtDdWrapper'); 
0
source

If you want to apply it to all displayed groups of Zend Form forms (for a specific form), an easier way:

 $form->setDisplayGroupDecorators(array( 'FormElements', 'Fieldset', )); 

NOTE: this only changes the previously defined displayed groups.

+8
source

The removeDecorator Zend_Form_Decorator_DtDdWrapper parameter did not work, so I used:

 $group = $form->getDisplayGroup('the name of the group'); $group->removeDecorator('DtDdWrapper'); 
+5
source

To not manually remove DtDd from each display group, you can use:

 foreach ($this->_displayGroups as $dg){ $dg->removeDecorator('DtDdWrapper'); } 
+1
source

Source: https://habr.com/ru/post/1339220/


All Articles