Validate Radio Button Group

I used below code to generate a radio button list.


echo GxHtml::activeRadioButtonList($model,'id',$listGC,array('separator'=>'  '));

echo $form->error($model,'id'); 

Now due to some design changes, I have to apply different class to each radio button. So i tried to use radio button but nothing is working out.Following different code I have tried.

I tried below code with and without uncheckedValue and id as htmloptions


$form->radioButton($model, 'id', array('value'=>4,'uncheckValue'=>NULL,'id'=>'GC_id_0'));

$form->radioButton($model, 'id', array('value'=>4,'uncheckValue'=>NULL,'id'=>'GC_id_1'));



I also tried below code with and without uncheckedValue and id as htmloptions


GxHtml::activeRadioButton($model, 'id', array('value'=>4,'uncheckValue'=>NULL,'id'=>'GC_id_0'));

GxHtml::activeRadioButton($model, 'id', array('value'=>4,'uncheckValue'=>NULL,'id'=>'GC_id_1'));

Validation not working with radio button groups…It use to work when I used activeRadioButtonList. Below are the rules.


public function rules() {

        return array(

            array('id','required','message'=>'Please select a theme'),

            array('category', 'length', 'max'=>100),

            array('category,description', 'safe'),

            array('description', 'default', 'setOnEmpty' => true, 'value' => null),

            array('id, category, description', 'safe', 'on'=>'search'),

        );

}

Can you post the html that is currently being generated for your radio buttons? That will help to narrow down the problem.

Have you tried


$form->radioButtonList()

I had a similar problem with drop downs, might work for you.

As far as I understand, mihir wants to render each radio button separately, so he/she can assign a different class to each.