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
You might need to write a custom module for this:
- Use hook_form_alter for the specific form and call form_get_errors.
- 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?– yakovCommented Jan 4, 2012 at 8:24
-
1var_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 BunkCommented Jan 4, 2012 at 18:15