refactored clearformerrors to use provided class name