How to create checkbox group in yii2?
That's what we need
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-primary active">
<input type="checkbox" autocomplete="off" checked> Checkbox 1 (pre-checked)
</label>
<label class="btn btn-primary">
<input type="checkbox" autocomplete="off"> Checkbox 2
</label>
<label class="btn btn-primary">
<input type="checkbox" autocomplete="off"> Checkbox 3
</label>
</div>
That's what I have
<?
$options = ['uncheck'=>0];
echo ButtonGroup::widget([
'options' => [
'data-toggle' => 'buttons'
],
'buttons' => [
$form->field($model, 'field1')->checkbox($options),
$form->field($model, 'field2')->checkbox($options),
$form->field($model, 'field3')->checkbox($options),
],
]);
?>
What I need to add in my code, to generate that markdown?
Aucun commentaire:
Enregistrer un commentaire