> The above is why -- each element you're adding has the same internal
> name in Zend_Form -- which means you're overwriting the element on each
> iteration.
>
> Elements in Zend_Form are meant to have discrete names -- which was why
> I recommended the "aggregate" element approach in my last post.
Thank you again,
I'll forever follow your suggestions ;)
I'm doing:
$form->addElement('hidden', 'id_'.$value, array(
'name' => 'id',
'value' => $value,
'attribs' => array('id' => 'id_'.$value),
'isArray' => true,
'required' => true
));
The only thing I can say it's about the "id" given to the wrappers
if the element _isArray ZF shoudn't put the id attrib to the dd and dt
tags AS IS or I'll get an invalid XHTML
eg.
<dt id="id-label"> </dt>
<dd id="id-element"><input type="hidden" name="id[]" value="1" id="id_1"
/></dd>
<dt id="id-label"> </dt>
<dd id="id-element"><input type="hidden" name="id[]" value="2" id="id_2"
/></dd>
<dt id="id-label"> </dt>
<dd id="id-element"><input type="hidden" name="id[]" value="3" id="id_3"
/></dd>
...
line 349 column 1 - Warning: <dt> anchor "id-label" already defined
line 350 column 1 - Warning: <dd> anchor "id-element" already defined
Thank you again for your help
--
Simone Cosci
ZF n00b :)
没有评论:
发表评论