using multiple radio button

You are viewing revision #6 of this wiki article.
This version may not be up to date with the latest version.
You may want to view the differences to the latest version.

next (#7) »

when we use multiple radio buttons with same name in Yii many people have the problem on getting the value of the selected radiobutton. we can use radioButtonList for that. But if we need to use radioButton itself to place the button any where in a view.

we need to have include one more parameter in htmloption array()


Usage ΒΆ

echo CHtml::radioButton('btn',false,array('value'=>'1','name'=>'btnname','uncheckValue'=>null)); 

//or we can use it in activeRadioButton()

echo $form->radioButton($model,'name',array('value'=>1,'uncheckValue'=>null));
echo $form->radioButton($model,'name',array('value'=>2,'uncheckValue'=>null));

so we can place any where in a page

6 0
Viewed: 54 878 times
Version: Unknown (update)
Category: Tips
Written by: francis ja
Last updated by: Rohit Suthar
Created on: Mar 7, 2012
Last updated: 3 years ago
Update Article


View all history

Related Articles