cactiveform js validation not working?

I wonder anyone has the same problem as me when using CActiveForm. Even if enableAjaxValidation is set true, the validation is still not done through ajax. So I went through the framework coding, and found that in order to get yiiactiveform registered, enableAjaxValidation must be enabled and CActiveForm::_attributes must not empty.

But CActiveForm::_attributes is a private variable, I am not allow to set. CActiveForm::_attributes is set in the later part - CActiveForm::_attributes = array_value($clientOptions[‘attributes’]);

So how do I solve this problem?

look at this . last post .

if you use Gii to generate a can check the generated Form. you will see that Ajax validation is working.

can you post the Code ? or send it to me . i will get i work .

Thanks James for your post. I read through and found the solution. All I have to do is to get $form->error(); insert and it will register yiicactiveform javascript in.

But I wonder why do I need to insert $form->error when my clientOptions[‘inputContainer’] is set ‘span’ and not the default error tag.

even though i added $form->error(); in my view and modified cActiveform as public $enableClientValidation=true; to make default values as enabled. but still validations are not working in my form.