Yii Cgrid View Button Update Button
#1
Posted 24 January 2013 - 01:42 AM
400,'Invalid request. Please do not repeat this request again.'
Meaning the value submitted is through GET not POST.So,why did the delete button work for me?
#2
Posted 24 January 2013 - 02:50 AM
#3
Posted 24 January 2013 - 03:21 AM
Maurizio Domba, on 24 January 2013 - 02:50 AM, said:
#4
Posted 24 January 2013 - 03:38 AM
#5
Posted 24 January 2013 - 04:01 AM
My action delete function in the controller.
public function actionDelete($id)
{
if(Yii::app()->request->isPostRequest)
{
$a=A::model()->findByPk($id);
$a->delete();
if(!isset($_GET['ajax']))
$this->redirect(array('index','id'=>$id));
}
else
throw new CHttpException(400,'Invalid request. Please do not repeat this request again.');
}
My action Update in the controller
public function actionUpdate($id)
{
if(!Yii::app()->request->isPostRequest)
{
$a=A::model()->findByPk($id);
if(isset($_GET['ajax']))
$this->redirect(array('index','id'=>$id));
$this->render('view',array(
'b'=>$b
));
}
else
throw new CHttpException(400,'Invalid request. Please do not repeat this request again.');
}
Only here after submitting the view page which is rendered it gives me the above exception(400).
#6
Posted 24 January 2013 - 04:37 AM
The first line is
if(!Yii::app()->request->isPostRequest)
and as the update is a GET and not a POST you get that error, just remove this check
#7
Posted 24 January 2013 - 05:07 AM
Maurizio Domba, on 24 January 2013 - 04:37 AM, said:
The first line is
if(!Yii::app()->request->isPostRequest)
and as the update is a GET and not a POST you get that error, just remove this check
#8
Posted 24 January 2013 - 05:12 AM
OK, but in any case that line is not needed so remove it regardless...
Please post your update button configuration - what is it's URL i.e. the URL that gets called when you press the button?
#9
Posted 24 January 2013 - 05:17 AM
Maurizio Domba, on 24 January 2013 - 05:12 AM, said:
OK, but in any case that line is not needed so remove it regardless...
Please post your update button configuration - what is it's URL i.e. the URL that gets called when you press the button?
#11
Posted 28 January 2013 - 09:00 AM

Help












