Answer the question
In order to leave comments, you need to log in
Yii2. Data not parsed during ajax form validation?
Hi friends.
Faced an anomaly (for me). Before that, I worked a lot with Yii1, there were no such problems.
I work with the default registration form that is installed in yii2.
Additionally, I specified the settings:
$form = ActiveForm::begin(['id' => 'signupform',
'enableAjaxValidation' => true,
'enableClientValidation' => false]);
if (\Yii::$app->request->isAjax && $model->load(\Yii::$app->request->isPost)) {
\Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
return \yii\widgets\ActiveForm::validate($model);
}
Answer the question
In order to leave comments, you need to log in
$model->load(\Yii::$app->request->isPost)
replaced by$model->load(\Yii::$app->request->post)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question