Answer the question
In order to leave comments, you need to log in
How to see where the error is when adding an entry in yii2?
Classic controller
public function actionCreate()
{
$model = new Post;
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id]);
} else {
return $this->render('create', [
'model' => $model,
]);
}
}
Answer the question
In order to leave comments, you need to log in
It also should not be registered in the controler. Try adding yii2x.com/display-form-errors-errorsummary
<?= $form->errorSummary($model)
right after creating the form . ?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question