Yii framework radiobuttonlist

user1378939 picture user1378939 · May 7, 2012 · Viewed 13k times · Source

Can anyone shine a light on how to determine which radio button has been selected when the form has been submitted?

I am using CActiveForm::radioButtonList?

Answer

sl4mmer picture sl4mmer · May 7, 2012

You don't need to determine it. Client will transmit its value in POST data.

For example such code

<?=$form->radioButtonList($person,'gender_code',array('m'=>'Male','f'=>'Female')); ?>

will form POST[gender_code]=m or POST[gender_code]=f