I have a Drupal 7 form which I'm allowing the user to submit via AJAX. If the user does not fill out required fields, or enters invalid information, I can return that and alert the user via the
form_get_errors() function. The problem is that these values are still on the "display stack" (not the correct term, I'm sure) - when the user refreshes the page, or navigates to another one, these previous errors are displayed.
Is there a way to set these errors not to display once I've grabbed them with
EDIT: The session variable 'messages' is set at
$_SESSION['messages']['error'], which is where the display of the errors is driven from. I could wipe this out by doing something like
unset($_SESSION['messages']['error']), but I feel like this is very hacky. The
drupal_static_reset() function also will not help, since it doesn't eliminate the values in the messages array.