yiiactiveform validation - error messages

I’m tired of this jquery.yiiactiveform.jс in yii 1.1.9 nothing works correctly.

  1. if i use ajax validation the captcha does’t work

  2. if i use client validation without validateOnSubmit and just submit the form, then when the fields are entered correcty the error css is not removed from the control, just error message disappears.

  3. if i use client validation and validateOnSubmit then jquery multifile upload does’t work and i need to click several times on submit button to submit the form.

Can you please give me working scenario, how to use client validation?

this is the form:

  1. jquery multifile upload

  2. text input

  3. captcha

  4. submit button




so after debugging i have found the error if validateOnSubmit is false,

when server site validation is performed and the "error" css is set to the control, but when client site validation is made after that, the "error" css is removed ONLY from the container

quick fix: please make it better

$.fn.yiiactiveform.updateInput = function (attribute, messages, form) {

                attribute.status = 1;

                var $error, $container,

                        hasError = false,

                        $el = form.find('#' + attribute.inputID);

                if($el.length) {

                        hasError = messages !== null && $.isArray(messages[attribute.id]) && messages[attribute.id].length > 0;

                        $error = form.find('#' + attribute.errorID);

                        $container = $.fn.yiiactiveform.getInputContainer(attribute, form);


                                attribute.validatingCssClass + ' ' + 

                                attribute.errorCssClass + ' ' + 




                        form.find('#' + attribute.inputID).removeClass(

                                attribute.validatingCssClass + ' ' + 

                                attribute.errorCssClass + ' ' + 



                        if (hasError) {




                        else if (attribute.enableAjaxValidation || attribute.clientValidation) {



                        if (!attribute.hideErrorMessage) {



                        attribute.value = getAFValue($el);


                return hasError;


NOTE: as you posted on the announcement thread I split your post to a new topic so that we can discuss your problem without clobbering the announce…

Normally the client validation validates the same thing as the server one… it can happen that the client validation does check only a subset of what the server validation does… in this case the server validation validates something more in addition to the client validation…

so by this case… is the server sets an error… the client validation cannot validate is as OK… the server needs to say it’s OK…


Can you explain more your use case…

I have this same issue. My use case is a wizard, where a user presses Next even though there are errors.

In such a case, the form is rendered with the bad data, and CHtml adds errorCss class to lots of things (including labels). When the user subsequently corrects the field and tabs out, client-side validation clears the error class from the div, but the label remains in red.

So CHtml renderings with class=‘error’ is out-of-sync with client-side validation rendering-and-clearing of similar but different set of class=‘error’.

Perhaps a fix is for client-side validation to clear the error class from both the div and it’s children?

It would be great if you could create a simple test app with this so I can test on it to find the solution