lundi 6 février 2017

How to set Yii2 checkbox to checked when attribute name - array?

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

<?php
echo $form->field($model, 'permissions[clients][view_all]')
    ->checkbox([
        'uncheck'=>false,
        'labelOptions' => [
            'style' => 'padding-left:20px;'
        ]
    ])->label('View all');
?>

So how set activeChechbox to checked?




Aucun commentaire:

Enregistrer un commentaire