Problem With Cactiveform.aftervalidade

I’m trying to use afterValidade of CActiveForm and it doesn’t seems to work. I made this code =>



/* @var $this Itens_EmprestimoController */

/* @var $Itens_Emprestimo Itens_Emprestimo */

/* @var $form CActiveForm */


js:function(form, data, hasError) {


   return false;		




js:function(form) {


   return true;




<div class="form">

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





                             'beforeValidate'=>$js1))); ?>


I first trying to made an ajax request in afterValidade, but it doesn’t work then

i made this code to test afterValidade, beforeValidade works but afterValidade not.

I enable the performAjaxValidation in controller.

I use yii 1.1.12

Dear Friend

Kindly check after correcting this.


                             'afterValidade'=>$js,           //afterValidate


hi there is a problem with your heredoc I changed your js function to following and its working just try it


  $js="js:function(form, data, hasError) { alert('after'); return false; }"; 

  $js1="js:function(form) { alert('before'); return true; }"; 


thanks people… I change to afterValidate and it works (sorry, my error)