errorCssClass use by creating dynamic error message

Hi all,

I have one question and i will hope get answer:)

I talk about CActiveForm. I want make dynamic error message on form input tag.

For example if input tag not validated i want that input tag make with red border…

Do you know some best practices on how to do that??

So, what i do:

I show you, haw i describe my form head (this is just snippet of code, in my view are full code, with error $form->error($model,‘name’) tag`s )

[left]$form=$this->beginWidget(‘CActiveForm’, array(













				)); [/left]

I describe css class for that, enable enableAjaxValidation=true, but that style not assigned to input tag with error (i do many debug with firebug), but only fire if ‘validateOnChange’=>true (but this is only at once input, need on all by click submit).

For me this not working (no error display), can somebady help me on that??

Maybe are error on params i use?? Or need some more, who i don`t know…


Or need more information about it

If you want to validate the form on submiting set ‘validateOnSubmit’ to true (defaults to false) -

Thanks for you attention.

I want, that class assigned to param "errorCssClass" to appear in my ajax response view, if some input error occours. But i can`t do that - this not work for me.

This only works if ‘validateOnChange’=true, but it is not enough because that showing just only at one inputat once time. With ‘validateOnSubmit’=true “errorCssClass” don`t appear too.

In my preview post, i show my form setting, in view are $error tags with model… Everything works, but not that :(

My idea is to make border around input tag with different collor (i use ‘errorCssClass’ param for that), if error occours. And i`m looking just solution how to do that, my you have some practice on that?

Ok, i fix it my self by passing errors from controller direcly into view, and then manage it in view with js