add html ID to form fields
- matc1
- Member | 19
Hi, i've a question, how i can add html tag ‘id=’ to a form addCheckboxList element, with every check element with a different ID?
If i use for examples:
$form->addCheckboxList(‘label’, “Label”, array(1,2))
->setHtmlAttribute(“ID”, $id_domanda.“_”.$counter);
But i need to create 2 different ID for every 2 checkobox element.
Is It possible?
Thanks
Best Regards
Matteo
Last edited by matc1 (2019-10-04 18:02)
- Polki
- Member | 553
You should use manual rendering.
Something like:
{foreach $form['label']->items as $key => $label}
<label n:name="gender:$key"><input n:name="gender:$key" id="{$id_domanda.“_”.$counter}"> {$label}</label>
{/foreach}
or this:
{foreach $form['label']->items as $key => $label}
{input label:$key, id => $id_domanda.“_”.$counter} | {label label:$key}
{/foreach}