[SOLVED] getPageState not working in multipage form

Hello everybody!,

I’m working with getPageState and setPageState, and my forms are all with ‘stateful’=true. But when I try to retrieve the vars I’ve set (with sePageState), getPageState doesn’t return all the vars. For instance, in this case, $model->operador is the var that should field a RadioButton selection, and I have to force to retrieve its value:

This doesn’t work:




$model->attributes = $this->getPageState('step2',array());



This works (but dirty code, manual assignation):




$moreValues=$this->getPageState('step2',array());

$model->operador=$moreValues['operador'];



Am I doing something wrong?

Thanks in advance!!!

That’s strange.

Are you sure that there is some rule on operador? Maybe the problem is not the stateful form, but the fact that operador is not a safe attribute

Solved!

Thanks zaccaria, the attributes were not set to “safe”. I’m still trying to understand what a “safe” attribute is, but the thing is, that now it’s working. The matter is that it’s a 4 page form, so quite more complicated than in the examples… And it works perfect!

Recently I wrote a post explaining this… check this post - http://www.yiiframew…+ive#entry67001

It is also very well explained in the definitive guide