/** * validation via AJAX * @return mixed */ public function actionAjaxValidation($id = null) { if (isset($id)) { $model = $this->findModel($id); } else { $model = new Tenant(); } $model->load(Yii::$app->request->post()); Yii::$app->response->format = Response::FORMAT_JSON; return ActiveForm::validate($model); }