Issues

ZF-10679: Form ID overrides Fieldset ID and causes dupe IDs

Issue Type: Bug Created: 2010-11-12T14:14:36.000+0000 Last Updated: 2010-12-09T05:53:24.000+0000 Status: Resolved Fix version(s): - 1.11.1 (30/Nov/10)

Reporter: Dan Copeland (dcopeland) Assignee: Marc Hodgins (mjh_ca) Tags: - Zend_Form

Related issues: - ZF-3896

Attachments: - ZF-10679.patch

Description

This code:

<pre class="highlight">
$form1 = new Zend_Form();
$form1->setDecorators(
    array(
        'FormElements',
         array('Fieldset', array('legend' => '',
                'id' => 'fieldset-id')),
        'Form',
    )
);
$this->view->form1 = $form1;

produces this form:

<pre class="highlight">

While this code:

<pre class="highlight">
$form2 = new Zend_Form();
$form2->setDecorators(
    array(
        'FormElements',
        array('Fieldset', array('legend' => '',
                'id' => 'fieldset-id')),
        'Form',
    )
);
$form2->setAttrib('id', 'form2-id');
$this->view->form2 = $form2;

Produces this form:

<pre class="highlight">

Note the duplicate ID between the form and the fieldset. In Zend_Form_Decorator_Fieldset::getOptions() the ID of the form is added to the options for the fieldset element. Then in render(), because the fieldset has an ID attribute that attribute is not modified.

Expected behavior:

Form ID should not override fieldset ID and the two IDs should not match.

Comments

Posted by Marc Hodgins (mjh_ca) on 2010-11-13T15:09:18.000+0000

Thanks for the simple test case. Patch with unit test to resolve issue is attached.

Posted by Marc Hodgins (mjh_ca) on 2010-11-22T14:43:47.000+0000

Applied to trunk in r23425, 1.11 release branch in r23426

Have you found an issue?

See the Overview section for more details.

Copyright

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

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

Contacts