CActiveForm afterValidate problem

So, when i trying to set ‘afterValidate’ option and pass my functionName




<script type="text/javascript">

function formSend(form, data, hasError)

{

    alert(hasError);

}

</script>

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

            'enableAjaxValidation'=>true,

            'id'=>'contact-form',

            'clientOptions'=>array(

                'validateOnSubmit'=>true,

                'afterValidate'=>'formSend'

            )            

            )); ?>



yii output




$('#contact-form').yiiactiveform({'validateOnSubmit':true,'afterValidate':'formSend','attributes':[{'inputID':'ContactForm_name','errorID':'ContactForm_name_em_'},{'inputID':'ContactForm_email','errorID':'ContactForm_email_em_'},{'inputID':'ContactForm_subject','errorID':'ContactForm_subject_em_'},{'inputID':'ContactForm_body','errorID':'ContactForm_body_em_'}]}); 



functionName is in quotes, anybody can help?

try js:formSend

Thank you very much))

Note that because this option refers to a js function, you should prefix the value with ‘js:’ to prevent it from being encoded as a string. This option has been available since version 1.1.3.

use js:fun_name