0

I want to know how to preselect an option using the radiobuttonlistrow in yiibooster, I have read the yii documentation and in the case of radiobuttonlist it doest have an option to preselect the value but with yiibooster I can't find anyway to do this.

Any help will be highly appreciate

Gabriel

General Electric
  • 1,176
  • 3
  • 21
  • 44

1 Answers1

0

For this you have to know the option values before you render the View. For example in your view

<?php echo $form->radioButtonList($model,'attribute', array('0'=>'option1 ', '1'=>'option 2 ', '2'=>'option3 ')); ?>

Then before rendering this view in you action write

$model->attribute='1';

Then option1 will be selected when the raioButtonList is rendered.Similarly you can select other options as per your needs

Rafay Zia Mir
  • 2,116
  • 6
  • 23
  • 49