cactiveform radiobuttonlist default checked value

How can i set a default checked value in my radiobuttonlist?


echo $form->radioButtonList(TObject::model(),'obj_oid',$array,array( 'template'=>"

                   <tr><td>

                        {label}

					</td>

					<td>

						{input}

                   </td></tr>

                   "));

	 

In the controller, use:


$model= new TObject;

$model->obj_oid= 1;


if (isset($_POST['TObject']))

{

   $model->attributes=$_POST['TObject'];

   ...


}

$this->render('view', array('model'=>$model));



And in the view:




echo $form->radioButtonList($model,'obj_oid',$array,array( 'template'=>"

                   <tr><td>

                        {label}

                                        </td>

                                        <td>

                                                {input}

                   </td></tr>

                   "));



It didn’t work. What does $model->obj_oid=1; supposed to achieve?

Ok i get it now. Solved!

How did you solved?

it was an associative array, so instead of obj_oid=1 i had to do obj_oid=$array[0]

Thanks Dzsonny,

But small correction.

if(!isset($model->bw_xsp_auto_provision))

$model->bw_xsp_auto_provision= 1;

Its working fine.