mercredi 6 mai 2015

How to set Yii2's ActiveForm checkbox in checked state?

I'm looking for a simple solution for a "checked" state for the Yii2 ActiveForm checkbox control and I can't find a solution how to set it. I cant find any examples in the documentation.

I've tried to manipulate the rendering code

<?= $form->field($model, 'name')->checkbox()->label('Hi'); ?>

But it seems I need to modify the ActiveForm itself. How to make checkbox checked by default?




Aucun commentaire:

Enregistrer un commentaire