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.

1 Answer 1


_form_set_class() is called from a bunch of different theme functions, including

(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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.