A
A
ART42021-09-03 09:34:19
Yii
ART4, 2021-09-03 09:34:19

Call to a member function hasErrors() on null?

Good afternoon, I'm trying to make a button where, when clicked, a form opens. But an error occurs:

Call to a member function hasErrors() on null

Requires:
if ($this->model->hasErrors($attributeName)) {
            Html::addCssClass($options, $this->form->errorCssClass);
        }


controller
public function actionInsert() {
        $time = new Feedback();

        if ($time->load(Yii::$app->request->post())) {
            if ($time->insert()) {
                return $this->redirect(['page/index']);
            }
            Yii::$app->session->setFlash(
                'success',
                false
            );
        }
        return $this->render('insert', ['time' => $time]);
    }

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question