Redirect Issue In Zii Gridview [Solved]

Hi,

I have a Gridview with update ButtonColumn,

[b]actionUpdate:

[/b]




public function actionUpdate($id)

    {

            $model=$this->loadModel($id);

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

                {

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

 	                               if($model->save())

     	                                   $this->redirect(array('index'));

    	}


         	                   $this->render('_form',array(

                                    	'model'=>$model,

         	                   ));

    }



[b]

[/b]Problem is that after $model->save() page don’t redirect into actionIndex. what’s the reason?

I have similar code for actionCreate and it works well:

actionCreate:




	public function actionCreate()

	{

    	$model=new Category;

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

    	{

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

        	if($model->validate())

            	if($model->save())

                	$this->redirect(array('index'));

    	}

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

	}



I think you may need to check validation rules of your model (especially when updating data). If the page is not redirected, then $model->save() returns False, which means saving process failed.

You can call $model()->getErrors() to retrieve the validation errors.

[b]Solved

[/b]Isn’t set $_POST[‘category’] When triggering from the Gridview.