Zend Framework

Elements in DisplayGroups do not adhere to array notation of parent sub form

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.5.0RC1
  • Fix Version/s: 1.5.2
  • Component/s: Zend_Form
  • Labels:
    None
  • Fix Version Priority:
    Must Have

Description

If you have a display group within a sub form, the elements contained by the display group do not get namespaced within the rendered form correctly, which leads to issues during form submission.

For example:

$subForm = new Zend_Form_SubForm();
$subForm->setLegend('Attributes');

$subForm->addElement('text', 'foo')
        ->addElement('text', 'bar')
        ->addDisplayGroup(array('foo', 'bar'), 'foobar');

$form = new Zend_Form();
$form->addSubForm($subForm, 'attributes');
echo $form->render(new Zend_View());

One would expect the following HTML:

<form enctype="application/x-www-form-urlencoded" action="" method="post">
    <dl class="zend_form">
        <dt></dt>
        <dd><fieldset id="attributes">
            <legend>Attributes</legend>
            <dl>
                <dt></dt>
                <dd><fieldset id="foobar"><dl>
                    <dt></dt>
                    <dd><input type="text" name="attributes[foo]" id="attributes-foo" value=""></dd>
                    <dt></dt>
                    <dd><input type="text" name="attributes[bar]" id="attributes-bar" value=""></dd>
                </dl></fieldset></dd>
            </dl>
        </fieldset></dd>
    </dl>
</form>

But the following is actually received:

<form enctype="application/x-www-form-urlencoded" action="" method="post">
    <dl class="zend_form">
        <dt></dt>
        <dd><fieldset id="attributes">
            <legend>Attributes</legend>
            <dl>
                <dt></dt>
                <dd><fieldset id="foobar"><dl>
                    <dt></dt>
                    <dd><input type="text" name="foo" id="foo" value=""></dd>
                    <dt></dt>
                    <dd><input type="text" name="bar" id="bar" value=""></dd>
                </dl></fieldset></dd>
            </dl>
        </fieldset></dd>
    </dl>
</form>

Issue Links

Activity

Hide
Wil Sinclair added a comment -

Resetting 'fix version priority' and 'fix version' to be re-evaluated for next release.

Show
Wil Sinclair added a comment - Resetting 'fix version priority' and 'fix version' to be re-evaluated for next release.
Hide
Matthew Weier O'Phinney added a comment -

Scheduling for next mini release.

Show
Matthew Weier O'Phinney added a comment - Scheduling for next mini release.
Hide
Matthew Weier O'Phinney added a comment -

Fixed in trunk and 1.5 release branch as of r9406

Show
Matthew Weier O'Phinney added a comment - Fixed in trunk and 1.5 release branch as of r9406

People

Vote (3)
Watch (3)

Dates

  • Created:
    Updated:
    Resolved:

Time Tracking

Estimated:
1h
Original Estimate - 1 hour
Remaining:
1h
Remaining Estimate - 1 hour
Logged:
Not Specified
Time Spent - Not Specified