I am using drupal 6. All I want is to find the id of each element that has error in form_get_errors. I am using preprocess to theme the form error section and tried using $vars['form'] with no luck so far. how can i do that?

1 Answer 1


You might need to write a custom module for this:

  1. Use hook_form_alter for the specific form and call form_get_errors.
  2. Theme the results of form_get_erros with hook_theme to pass the results back to your theme.
  • I already wrote the module but how can i actually know what is the id (css id) for each error in form_get_errors?
    – yakov
    Jan 4, 2012 at 8:24
  • 1
    var_dump can show you the contents of the array that is returned with form_get_errors. It won't give you a css id until you output the results in the theme but at least you'll know what elements are available.
    – Ben Bunk
    Jan 4, 2012 at 18:15

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.