Problem With Ajax Form Validation

Hi All,

I am trying to implement Ajax form validation but it doesnot seem to be working for my project. I however created a sample test project and set all the variables right and could make it work. I even debugged it using firebug and getting the responses right for the test project.

I have an error while i inspect it with chrome.


Uncaught TypeError: Object [object Object] has no method 'yiiactiveform' 

Below is my code used to enable the form validation.



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

                'id' => 'op-form',

                'enableAjaxValidation' => true,

                'clientOptions' => array(

                    'validateOnSubmit' => true,




            <p class="note">Fields with <span class="required">*</span> are required.</p>

            <?php echo $form->errorSummary($model); ?>

            <div class="row">

                <?php echo $form->labelEx($model, 'pin'); ?>

                <?php echo $form->textField($model, 'pin', array('size' => 20, 'maxlength' => 20)); ?>

                <?php echo $form->error($model, 'pin'); ?>


           <?php $this->endWidget(); ?>


public function actionCreate() {

        $model = new Users;


        if (isset($_POST['Users'])) {

            $model->attributes = $_POST['Users'];

            if ($model->save())

                $this->redirect(array('view', 'id' => $model->id));


        $this->render('create', array(

            'model' => $model,



protected function performAjaxValidation($model) {

        if (isset($_POST['ajax']) && $_POST['ajax'] === 'op-form') {

            echo CActiveForm::validate($model);




Any help would be much appreciated. Thanks


'clientOptions' => array(

                    'validateOnSubmit' => true,


Should be used if you do client side validation which you don’t. So while am not saying its the source, tyr to remove it.

Also nice shot of firebug error window and post/response will give us idea of what is happening!