In general the delete action should be done by POST and the update action should be done by GET. The default generated Yii code in the delete action checks if the parameter are sent with POST, but in the update action there is no check for this… did you add it ?
Thank you for the suggestion.So,can you provide me any thing on how to use the Update feature of Cgrid view button.Also,please ask me for the code if you want.
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).
[color=#1C2837][size=2]and as the update is a GET and not a POST you get that error, j[/size][/color][color=#1C2837][size=2]ust remove this check [/size][/color]
No I did it deliberately,because it gives me an exception.But in my case it enters into the first if block…SO,Please help me in solving this GET and POST conundrum.