Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Redirect Issue

$
0
0
Hi,
I have a Gridview with update ButtonColumn,

actionUpdate:

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,
             	               ));
    }

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));
	}

Viewing all articles
Browse latest Browse all 18717

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>