Yii framework real time form validation with different scenario

Go To StackoverFlow.com


I have form with two ajax button checking two different scenario. The problem is, when I'm using scenario to check partly of the form all the real time validation (input color and error with div) not working. In fact when user focus on one of the field Its would mark it with green (Validation pass). But when the user click on the submit button, if he didn't fill the input correctly, Its will tell user that he didn't pass the form.

How can I show this message real time on the input color and error div when user fill not correctly the field?

2012-04-04 05:57
by Dar


You should active ajax validation in Yii! i think there is an option to validate while filling up box and other elements! I'm sure. I had this problem and solved it successfully! generate your form with Yii form helper set options to form class to make active validation excuse me for short answer.

2012-04-04 06:18
by Sayyed Muhammad Emami Razavi
I already did it. beginWidget('CActiveForm', array( 'id'=>'signup-form', 'enableAjaxValidation'=>true, 'enableClientValidation'=>true, )); ? - Dar 2012-04-04 06:23