ZF-3819: Ids not updating in cloned sub forms

Issue Type: Bug Created: 2008-07-31T10:33:29.000+0000 Last Updated: 2008-09-02T10:39:33.000+0000 Status: Resolved Fix version(s): - 1.6.0 (02/Sep/08)

Reporter: Matthew Weier O'Phinney (matthew) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_Form

Related issues: Attachments:


When cloning a single sub form to attach repeatedly in Zend_Form, the names update, but the ids do not. As an example:

<pre class="highlight">
$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:

<pre class="highlight">




As can be seen, the names are correct, but the ids are not.


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.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.