7 - How to Add Custom Error Class to Radio Button and Checklist Fields I created a field with Radio buttons and when it fails to validate, there is no red highlight around it.



There is only an error message at the top.



How can I add a custom CSS class to any radio button fields upon a failed validation?

I am already altering this form with hook_form_alter(); and have a custom validation function, so I am willing to work on a custom module for this but just need some help being pointed in the right direction.

I would ideally like to add a ".error" class or something to this div and customize it in my CSS to also give it a red border.

How can this be acheived?
Out of the box webforms created with Drupal core and the Webform module do not have in line error messaging and indicators for each form field.

You can either:


add custom hooks and javascript to get inline validation, or
install client-side validation module and associated javascript library to get validation/messaging for all standard form elements.  See https://www.drupal.org/project/clientside_validation