1

i have passed some values($list) fetched from database to yii2 default checkbox list and it is successfully showing the result

<?php $list=ArrayHelper::map(Questions::find()->all(),'id','question'); ?>
<?= $form->field($model, 'dept_id')->checkboxList($list); ?>

how can i pass the same $list with kartik checkboxlist,shown below

<?= $form->field($model, 'dept_id')->widget(CheckboxX::classname($list), [
    'initInputType' => CheckboxX::INPUT_CHECKBOX,
    'autoLabel' => true
])->label(false); ?>
Sumith Chalil
  • 348
  • 3
  • 22

1 Answers1

1

This widget allows three checkbox states [1, 0 and null] You could use Yii2: ActiveField CheckboxList Instead. This way you can specify *n options to in form of checkboxes.

Kalu
  • 561
  • 2
  • 7