I am trying to use the checkboxlist Activeform widget in the YII 2.0 Framework
in my case, I have an array called a βlistβ that has the names of the languages ββthat will appear as checkboxlist, now I can do it, but I want the checkboxes to be checked as downloadable forms.
$list = [0 => 'PHP', 1 => 'MySQL', 2 => 'Javascript']; $list2 = [0,2];
using the following line, I can get what I want using HTML helper classes:
<?= Html::checkboxList('CuisineId',$list2,$list); ?>
but I want this to be possible with the CheckboxList Activeform Widget, which according to the documentation should be used as follows:
static checkboxList ($ items, $ options = [])
So, in my case, I figured out how to pass a parameter to $ items, which looks like this:
<?= $form->field($record, 'CuisineId')->checkboxlist($list);?>
But now I donβt know how to pass parameters that will check the checkboxes.
php yii2
Cristus cleetus
source share