EDIT: Seems like what I’m trying to do with CGridView here is not possible. I will just stick with removing the POST restriction on delete actions.
Hello,
When I disable JavaScript in the browser, I get an error when clicking on the Delete button in the CGridView table.
This is the error I receive:
my_server is the name of my server and is the same as my_server.mywebsite.com/meeting/delete/126. But this is irrelevant (I’m using pseudo names here anyway).
The problem is related to this block of code in my Meeting controller:
public function filters()
{
return array(
'postOnly + delete', // we only allow deletion via POST request
);
}
And this is the code for my delete action:
public function actionDelete($id)
{
if(!$this->loadModel($id)->delete())
{
throw new CDbException('An error occured while trying to delete the meeting. Please try again or something.');
}
if(!isset($_GET['ajax']))
$this->redirect(array('meeting/schedule'));
}
Why won’t my app degrade gracefully when I disable JS? I still want to restrict the delete action to work only on POST requests, but how can I do that? How would I need to change the default delete button in CGridView so that it sends a POST request to delete the row when JS/AJAX is disabled?
Thanks.