In order to display the list of options to the users, I used following code:
public function getData($property)
{
$data=array(
'membership_fee' => array(
'Large Company & Organisation',
'Medium Company & Organisation',
'Small Company & Organisation ',
'Mini- Company & Organisation',
'Individual Membership ',
'Large Company & Organisation ',
'Medium Company & Organisation ',
'Small Company & Organisation',
'Mini- Company & Organisation ',
'Individual Membership ',
),
);
return $data[$property];
}
and
<div class="form-group">
<?= $form->labelEx($model, 'membership_fee', array('class' => 'col-xs-12 col-sm-4 control-label')) ?>
<div class="col-xs-12 col-sm-8">
<?= $form->radioButtonList($model, 'membership_fee', $model->getData('membership_fee'), array(
'template' => '<div class="radio col-xs-12 col-sm-6">{beginLabel}{input}{label}{endLabel}</div>',
'separator' => '',
)); ?>
<?= $form->error($model, 'membership_fee') ?>
</div>
</div>
But, these codes are saving data as the form of number (eg. if user chooses Large company and org it saves it to the database as 0, or if user chooses miduim company and org it saves it to the database as 1). I need to save data to the database as choosen option title not as number. How can i do it?