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

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

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

StringGrid issue in Delphi XE8 firemonkey mobile app -