public function actionValidate()
{
$cookies = Yii::$app->request->cookies;
$model_user = User::findByEmail($cookies->getValue('email', null));
$model_user->scenario = User::SCENARIO_VAR1;
if (Yii::$app->request->isAjax && $model_user->load(Yii::$app->request->post())) {
\Yii::$app->response->format = Response::FORMAT_JSON;
return ActiveForm::validate($model_user);
}
}
php><?php $form = ActiveForm::begin([
'id'=>'form-three',
'action' => '/site/save',
'validationUrl' => '/site/validate',
'enableAjaxValidation'=>true,
'validateOnChange'=>false,
'validateOnBlur'=>false,
]) ?>
php>