model attribute modified by radioButtonList

hi I’ve got a strange situation. I’ve generated CRUD for my model and in the _form view I’ve set a radioButtonList for one attribute and for some reason after modifying the radio buttons list selection the selected value isn’t being saved in the database.

I’ve checked the POST table in the FireBug and everything looks ok the values are being sent.

When I force model attribute value like this:


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

// echo $model->position results my default value: 0

$model->position = $_POST['FootballPlayer']['position'];

// echo $model->position results the selected value in the _form view

it is being saved. In my other controllers controlling attribute values works fine. Where should i look?

Read this part of the documentation - http://www.yiiframework.com/doc/guide/1.1/en/form.model#declaring-safe-attributes

Thanks mdomba I’ve fixed the model rules (there was no rule for model attribute witch was not being saved) and everything works fine :)