A
A
agent11562016-09-13 15:36:13
Yii
agent1156, 2016-09-13 15:36:13

Why doesn't CRUD remove data from a table?

The data is not deleted.
public function actionDelete($id)
{
$this->findModel($id)->delete();
return $this->redirect(['index']);
}
Bad Request (#400)
Failed to validate the submitted data.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2016-09-13
@slo_nik

Good afternoon.
The request must be sent via POST
In the controller, don't forget to include use yii\filters\VerbFilter;

public function behaviors()
    {
        return [
            'verbs' => [
                'class' => VerbFilter::className(),
                'actions' => [
                    'delete' => ['post'],
                ],
            ],
        ];
    }

Also, as an option, clean the browser cache, the runtime folder ...
ps The data is not deleted at all or is it deleted, but not the same?
Link 'delete' from ActiveColumn or do you form it yourself?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question