ask about yii active form validation call back on javascript

hi, i am using CActiveForm and it perform validation while click submit button.

I want to change the submit button to loading icon while form validate success and submit. how should i do that in jquery?

:unsure:

if i do this

$(‘form’).submit(function(){

$('#loadingWrapper').show();

});

it show the loading bar even though the validation is failed and form not submitted…

:unsure:

yii developers… no solution? am i forced to give up using active form? :mellow:

i found this… solve my problem

'clientOptions'=>array(


	'validateOnSubmit'=>true,


	'afterValidate'=>'js:formSend',


),

<script type="text/javascript" charset="utf-8">

function formSend(form, data, hasError)

{

if (&#33;hasError) {


	&#036;('#loadingWrapper').show();


	return true;


};

}

</script>