V
V
Vladimir2016-09-18 17:32:03
Yii
Vladimir, 2016-09-18 17:32:03

How to set checked in radio button in Yii2?

Good day! There is this line of code:

<?=$form->field($model, 'vip')->radioList(['0' => 'Нет', '1' => 'Да',])->label('VIP Статус') ?>

What parameter or what method should be registered in order to add the checked attribute to the input?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2016-09-18
@MasterGerold

Think so:
But it is also possible like this:

<?php 
$model->vip = 0;
?>
<?=$form->field($model, 'vip')->label('VIP Статус') ->radioList(['0' => 'Нет', '1' => 'Да',])?>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question