Cactiveform Onchange Error Issue

Hi,

Iam facing a simple issue. I have a form created using CActiveForm. I have enabled client side and ajax validation for this form. The ‘validateOnSubmit’ and ‘validateOnChange’ properties are set to true. The form is a forgot password form having only one text field for capturing user email address. Below the text box, there is a link which takes the user back to login page. My issue is, when i simply click the text box and then click the link, validation error is shown(‘Email cannot be blank’) and takes me to login page. It happens because ‘validateOnChange’ is set to true. Actually, i dont need any validation to fire when i tries to go back to login page. Is this possible?. Any help will be greatly appreciated. :)

Thanks.

Hello





<?php

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

                'id' => 'admin-form',

                'action' => $url,

                

                'enableAjaxValidation' => false,

                'enableClientValidation' => true,

                'clientOptions' => array(

                    'validateOnSubmit' => true,

                )

            ));

            ?>




Hi Ghanshyam,

I really appreciate your fast response and thanks for this reply. I want the validation to trigger on change as well, but not on clicking that link which takes me to login page. ie, ‘validateOnChange’ should be true. I tried this

//View file

if(Yii::app()->request->requestUri==’/user/forgot-password’) {

echo $form->error($userForgotPasswordForm,‘email’, array(‘class’=>‘universityFormError errorMessage’));

}

ie, show error only in forgot password page. not in login page.

But its not working.

Thanks