This is a helper method that simplifies the way of writing AJAX validation code.
For example, you may use the following code in a controller action to respond
to an AJAX validation request:
php
$model = new Post;
$model->load(Yii::$app->request->post());
if (Yii::$app->request->isAjax) {
Yii::$app->response->format = Response::FORMAT_JSON;
return ActiveForm::validate($model);
}
... respond to non-AJAX request ...
To validate multiple models, simply pass each model as a parameter to this method, like
the following:
php
ActiveForm::validate($model1, $model2, ...);