active form fields - error class

How can I prevent class="error" from being added to the active form fields?

As I now use errorSummary to display the errors and activeLabelEx is also highlighted, I no longer need highlighting on the form fields.

I know I can just modify the css rule to take off the background colour but is it possible to just stop the class attribute from being added?

Anyone able to advise? Thanks.

You can blank the $errorCss static property of CHtml in your view like so:


<?php CHtml::$errorCss = ""; ?>

However, this setting will be global to your entire application.

If you want to change the styling of error for any particular label or page, override it in your CSS based on the context. For example, if your labels or input fields are within a box with an id of "login," you could override the styling like so:


#login .error {

    background: none;

}