How to remove 'error' class from form field? I need to remove the error class from field after form submit. How to do that?

I found the function called _form_set_class but I suppose I can't overwrite it.
_form_set_class() is called from a bunch of different theme functions, including


theme_checkbox()
theme_fieldset()
theme_file()


(the rest are here)

You can override whichever of those functions you need to in your theme by renaming the function as (e.g.)

function MYTHEME_checkbox($vars) {


Then copy in the original code from the function, remove the call to _form_get_class(), and replace it with whatever makes sense for your use case.