Ajax validation before ajax submit

I’m trying to call ajax validation when submit button pressed. Form should be sent via ajax, so i’m using the next code:


$this->beginWidget('zii.widgets.jui.CJuiDialog', array(








                                     success: function(data) {



                                dataType: "json"





$this->render('test/_form', array('model' => $model));


and form:


$form = $this->beginWidget('CActiveForm', array(

            'id' => 'test-form',

            'action'=> CHtml::normalizeUrl(array('test/create')),

            'enableAjaxValidation' => true,

            'clientOptions' => array(






When submit button is pressed no validation occurred.

I tried use line $.fn.yiiactiveform.validate("#test-form", function(a){console.log(a);}, function(a){console.log(a)});

but it’s not working.

I need to call default yii ajax validator using js. Now this validator called when i set ‘validateOnChange’=>true. But i need to call it in my JS.