ZF-3819: Ids not updating in cloned sub forms
Description
When cloning a single sub form to attach repeatedly in Zend_Form, the names update, but the ids do not. As an example:
$subForm = new Zend_Form_SubForm();
$subForm->addElement('text', 'foo');
$form = new Zend_Form(array('action' => '/foo/bar', 'method' => 'post'));
for ($i = 1; $i < 4; ++$i) {
$name = 'sub' . $i;
$sub = clone $subForm;
$form->addSubForm($sub, $name);
}
echo $form->render(new Zend_View);
This will result in the output:
As can be seen, the names are correct, but the ids are not.
Comments
Posted by Matthew Weier O'Phinney (matthew) on 2008-08-04T20:40:35.000+0000
The issue was that cloning was not cloning the elements, display groups, or sub forms. This is now resolved in trunk and 1.6 release branch.
Posted by Wil Sinclair (wil) on 2008-09-02T10:39:33.000+0000
Updating for the 1.6.0 release.