I am creating a survey for any guest to complete. You do not need to be logged in to create the survey, but Admins can manage it.
Everything works fine, but once the survey is sumbit it does not redirect to my Thank You page but rather to the Login Page. What am I missing?
My controller have theses accessRules
public function accessRules()
{
return array(
array('allow', // allow all users to perform 'index' and 'view' actions
'actions'=>array('create'),
'users'=>array('*'),
),
array('allow', // allow authenticated user to perform 'create' and 'update' actions
'actions'=>array('create','update'),
'users'=>array('@'),
),
array('allow', // allow admin user to perform 'admin' and 'delete' actions
'actions'=>array('admin','delete','index','view'),
'users'=>array('admin'),
),
array('deny', // deny all users
'users'=>array('*'),
),
);
}
My create action looks like this
public function actionCreate()
{
$model=new Survey;
// Uncomment the following line if AJAX validation is needed
$this->performAjaxValidation($model);
if(isset($_POST['Survey']))
{
$model->attributes=$_POST['Survey'];
if($model->save())
$this->redirect('/site/page', 'view'=>'surveycomplete');
}
$this->render('create',array(
'model'=>$model,
));
}
I tried diff. variations of the redirect. Even the site index does the same.
$this->redirect(’/site/index’);
Thanks