ZF-10387: function _addDisplayGroupObject has to remove elements from Zend_Form - else rendering the elements twice
Description
When you add an object of Zend_Form_DisplayGroup to the Zend_Form it will not remove the elements in Zend_Form. When rendering the form, it will render the elements twice. (in the decorator FormElements of Zend_Form and the in the decorator for the Zend_Form_DisplayGroup)
testcase: (it will render the element test twice)
$oForm = new Zend_Form();
$oForm->addElement('text','test');
$oDisplayGroup = new Zend_Form_DisplayGroup('bug',$oForm->getPLuginLoader('decorator'));
$oDisplayGroup->addElement($oForm->getElement('test'));
$oForm->addDisplayGroups(array($oDisplayGroup));
echo $oForm;
solution: add following code in _addDisplayGroupObject in Zend_Form (it will remove the elements from the ordering in Zend_Form, so they won't be rendered)
foreach ($group->getElements() as $element) {
unset($this->_order[$element->getName()]);
}
Comments
Posted by Matthew Weier O'Phinney (matthew) on 2010-08-27T07:50:23.000+0000
Can you detail:
Your report presents a solution, but it doesn't clearly state what the problem is. It's entirely possible that it's by design, but we cannot be certain until we have this information.
Thanks!
Posted by Benjamin Heek (benovie) on 2010-08-27T08:45:48.000+0000
edited description with the real problem
Posted by Richard Tuin (richardtuin) on 2011-01-20T14:07:37.000+0000
I believe this issue relates to ZF-10958
Posted by Richard Tuin (richardtuin) on 2011-09-22T19:24:13.000+0000
Issue ZF-11729 is a duplicate of this and is resolved/fixed.