validation form don't works when ajax is enable


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.


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


It is "null" by default.