Note: This HOWTO covers Drupal 6.x.
By default, Drupal adds an .error class to the form element itself: textarea, select, input, and so on. Sometimes, that’s not good enough. Maybe a client needs the label’s color changed — or a big, red border encompassing both the label and input elements.
This can be achieved by overriding theme_form_element() to add an error class to div.form-item, the div that wraps all elements in a form.