validate() public static method
Validates one or several models and returns an error message array indexed by the attribute IDs. 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: $model = new Post;
$model->load(Yii::$app->request->post());
if (Yii::$app->request->isAjax) {
Yii::$app->response->format = Response::FORMAT_JSON;