public function actionFirstform() { if (Yii::$app->request->isAjax) { Yii::$app->response->format = Response::FORMAT_JSON; $FormUser = new FormUser(); $FormUser->load(Yii::$app->request->post()); die(print json_encode(ActiveForm::validate($FormUser))); } else { return $this->goHome(); } }