override addCheckboxList add htmlId element

2 months ago

matc1
Member | 14
+
0
-

Hi everybody is it possible to override addCheckboxList function and add single htmlId for every single checkbox item of the group list?
I'm e unable to set different htmlId for every checkbox item of the list.
I cant'use manual rendering.
Thank's a lot.

2 months ago

David Matějka
Moderator | 6093
+
+2
-

hi, you can set id attribute for each input using this:

		$form->addCheckboxList('test', null, ['a' => 'hello a', 'b' => 'hello b'])
			->getControlPrototype()->addAttributes(['id:' => ['a' => 'idA', 'b' => 'idB']]);

2 months ago

matc1
Member | 14
+
0
-

Great Thanks!