I try use Html::checkboxList from The Definitive Guide to Yii 2.0
<?= Html::checkboxList('roles', [16, 42], ArrayHelper::map($roleModels, 'id', 'name')) ?>
I don’t know what it is:
[16, 42]
I try use Html::checkboxList from The Definitive Guide to Yii 2.0
<?= Html::checkboxList('roles', [16, 42], ArrayHelper::map($roleModels, 'id', 'name')) ?>
I don’t know what it is:
[16, 42]
http://www.yiiframework.com/doc-2.0/yii-helpers-basehtml.html#checkbox()-detail
Scroll down a bit and you will see checkboxlist info.
public static string checkboxList ( $name, $selection = null, $items = [], $options = [] )
So [16,42] are the currently selected items. If I had a list of checkboxitems and loaded the page, the items that have values of 16 & 42 would appear checked.
Thanks for answer.
I understand.