Hi folks.
I have an issue while displaying several forms of the same model on the same page. The problem is that with the NameFormat, the fields have the same ID :
$this->widgetSchema->setNameFormat('display[%s]');
Will display
<form class="update_display_form" id="update_display_0" action="/iperf/web/frontend_dev.php/update_display" method="post">
<input type="checkbox" name="display[displayed]" checked="checked" id="display_displayed" />
<label for="display_displayed">test</label>
</form>
<form class="update_display_form" id="update_display_1" action="/iperf/web/frontend_dev.php/update_display" method="post">
<input type="checkbox" name="display[displayed]" checked="checked" id="display_displayed" />
<label for="display_displayed">truc</label>
</form>
And if you click on the second label, it will activate the first checkbox So I thought I could use the object id to make them unique :
$this->widgetSchema->setNameFormat('display'.$this->getObject()->getId().'[%s]');
But then I can not process the request, since I don't know the name of the parameters.
The best option I found was to set an ID :
$this->widgetSchema['displayed']->setAttributes(array("id" => "display".$this->getObject()->getId() ));
but then I totally loose the connections between the label and the checkbox.
The problem would be solved if I could change the "for" attribute of my label. Does somebody know how to do that ? Or any other option ?