admirau wrote:
>
> When I create a form, add subForm (1), and then a subForm to this subForm
> (2),
> id attribute of subForm (2) are not prepended with name of subForm(1).
>
> How to fix that?
> I saw there was a similar bug with display groups.
>
> --
> regards
> takeshin
>
Here is an example which illustrates this issue:
$form = new Zend_Form;
$checkbox = new Zend_Form_Element_Checkbox('checkbox1',
array('label'=>'checkbox 1'));
$form->addElement($checkbox);
$checkbox = new Zend_Form_Element_Checkbox('checkbox2',
array('label'=>'checkbox 2'));
$form->addElement($checkbox);
$subform1 = new Zend_Form_SubForm('subform1');
$checkbox = new Zend_Form_Element_Checkbox('checkbox1',
array('label'=>'checkbox 1'));
$subform1->addElement($checkbox);
$checkbox = new Zend_Form_Element_Checkbox('checkbox2',
array('label'=>'checkbox 2'));
$subform1->addElement($checkbox);
$form->addSubForm($subform1, 'subform1');
This produces the following HTML:
<form enctype="application/x-www-form-urlencoded" action="" method="post">
<dl class="zend_form">
<dt id="checkbox1-label">
<label for="checkbox1" class="optional">checkbox 1</label>
</dt>
<dd id="checkbox1-element">
<input type="hidden" name="checkbox1" value="0" /><input
type="checkbox"
name="checkbox1" id="checkbox1" value="1" />
</dd>
<dt id="checkbox2-label">
<label for="checkbox2" class="optional">checkbox 2</label>
</dt>
<dd id="checkbox2-element">
<input type="hidden" name="checkbox2" value="0" /><input
type="checkbox"
name="checkbox2" id="checkbox2" value="1" />
</dd>
<dt id="subform1-label"> </dt><dd id="subform1-element">
<fieldset id="fieldset-subform1">
<dl>
<dt id="checkbox1-label">
<label for="subform1-checkbox1"
class="optional">checkbox 1</label>
</dt>
<dd id="checkbox1-element">
<input type="hidden"
name="subform1[checkbox1]" value="0" /><input
type="checkbox" name="subform1[checkbox1]" id="subform1-checkbox1" value="1"
/>
</dd>
<dt id="checkbox2-label">
<label for="subform1-checkbox2"
class="optional">checkbox 2</label>
</dt>
<dd id="checkbox2-element">
<input type="hidden"
name="subform1[checkbox2]" value="0" /><input
type="checkbox" name="subform1[checkbox2]" id="subform1-checkbox2" value="1"
/>
</dd>
</dl>
</fieldset>
</dd>
</dl>
</form>
As you can see, id attributes are duplicated, and for attribute points to
non existing id.
--
regards
takeshin
--
View this message in context:
http://www.nabble.com/sub-subForm-not-namespaced-correctly--tp25097728p25100931.html
Sent from the Zend Framework mailing list archive at Nabble.com.