From f0221fb84f4bdf88396f51dc9d95aefc277e6714 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Tue, 26 Aug 2014 02:39:05 +0400 Subject: [PATCH] Fixes #4126 --- docs/guide/input-validation.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/docs/guide/input-validation.md b/docs/guide/input-validation.md index 33f58f5..3ff638e 100644 --- a/docs/guide/input-validation.md +++ b/docs/guide/input-validation.md @@ -620,8 +620,17 @@ You can use AJAX-based validation in this case. It will trigger an AJAX request input while keeping the same user experience as the regular client-side validation. To enable AJAX validation for the whole form, you have to set the -[[yii\widgets\ActiveForm::enableAjaxValidation]] property to be `true`. You may also turn it on or off -for individual input fields by configuring their [[yii\widgets\ActiveField::enableAjaxValidation]] property. +[[yii\widgets\ActiveForm::enableAjaxValidation]] property to be `true` and specify `id` to be unique form identifier: + +```php + 'contact-form', + 'enableAjaxValidation' => true, +]); ?> +``` + +You may also turn AJAX validation on or off for individual input fields by configuring their +[[yii\widgets\ActiveField::enableAjaxValidation]] property. You also need to prepare the server so that it can handle the AJAX validation requests. This can be achieved by a code snippet like the following in controller actions: