php - How to preselect/check a default radio button in yii2 RadioList()? -


i want radio button preselected in form.

 <?= $form->field($model, 'config')->radiolist(['1'=>'automatic entry',2=>'manual entry'])      ->label('barcode/book no generation'); ?> 

the preselected values taken $model->config. means should set attribute value want preselected :

$model->config = '1'; $form->field($model, 'config')->radiolist([     '1' => 'automatic entry',     '2' => 'manual entry', ]); 

the relevant doc in activeform class.


Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -