A
A
Andrew2017-08-28 15:07:48
Yii
Andrew, 2017-08-28 15:07:48

Yii2. How to create a feedback form on the error.php page (404 page)?

Good afternoon!
Please tell me how to connect the feedback form in yii2 for the error.php page?
For other pages (for example, the main one) I write in SiteController:

public function actionIndex() {
        $model = new MyForm();
        if ($model->load(Yii::$app->request->post()) && $model->contact(Yii::$app->params['adminEmail'])) {
            Yii::$app->session->setFlash('contactFormSubmitted');

            return $this->refresh();
        }
        return $this->render('index', [
            'model' => $model,
            ]);
    }

How to make a form for error.php, because it is connected using:
public function actions()
    {
        return [
            'error' => [
                'class' => 'yii\web\ErrorAction',
            ],
        ];
    }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Fedorov, 2017-08-28
@PowSl

Actually disable the use of yii\web\ErrorAction as an error page and implement your own actionError method in the controller that will do everything you need

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question