activeRadioButtonList attribute values empty on actionCreate

Hello, I try to use activeRadioButtonList in my form like this:

$accountStatus = array('0'=>'No', '1'=>'Yes');

              echo CHtml::activeRadioButtonList($model,'attending',$accountStatus,array('separator'=>' '));

On the controller side in the actionCreate, I have:



When I print_r the $_POST, I get values, but when I print_r or check the insert of the attributes, they’re empty.

Does anybody have an idea?

did you set the validation rules for those attributes ?

Only this:

array('activity_id, attending, present, speaker, logistic, remark', 'safe', 'on'=>'search'),

that’s why it’s not working… read about safe attributes and massive assignments -

Got it,

but this poses the next problem. For the field "attending" for example, I have a radio button list for yes / no,

but I want to be able to create en entry, even if the user doesn’t make any choice, and therefor safe a null value in the database.

When I create a rule like:

array('coworker_id, activity_id, present, speaker, logistic, remark', 'required'), 

An error comes up because I left one of the radio buttons unselected.

I read about the allowEMpty, but I can’t seem to create a working rule with it.

How to I solve this?

Did you read the link I gave you before…

Here is a copy/paste from that section

Mmm, I read it, but did not realize that that was the solution.

Thanks so much!

I can finally go on with this after a long struggle.