validation form don't works when ajax is enable

hi,

i am newbie.

i am using ajax for my unique rule but when ajax is enable in the form

the submit button dosen’t work.

<?php $form = ActiveForm::begin([ ‘id’=> ‘form-register’,

//'enableClientValidation' =&gt; true,


'method' =&gt; 'post',

‘action’ => Url::to([‘registration/create’]),

‘enableAjaxValidation’ => true,

// ‘validateOnSubmit’=>true,

]

);?>

public function actionCreate()

{


    &#036;model = new Etablissement();


	&#036;mail = new Mail();


    &#036;users = new Users();


    &#036;tel = new Telephone();


  


	


		 if (Yii::&#036;app-&gt;request-&gt;isAjax &amp;&amp; &#036;users-&gt;load(Yii::&#036;app-&gt;request-&gt;post())) {


      Yii::&#036;app-&gt;response-&gt;format = Response::FORMAT_JSON;


       return ActiveForm::validate(&#036;users);


     }

UniqueValidator usually can’t operate in client side, since it needs to access DB to check whether the value is unique or not. It has to be done on the server side, or by ajax validation.

What you have to do is disable "clientValidation" on your form as a whole, or only the fields that have to be unique.

ActiveForm::enableClientValidation

http://www.yiiframework.com/doc-2.0/yii-widgets-activeform.html#$enableClientValidation-detail

Note that it is “true” by default. Commenting out won’t work.

ActiveField::enableClientValidation

http://www.yiiframework.com/doc-2.0/yii-widgets-activefield.html#$enableClientValidation-detail

It is "null" by default.