How do I clear a drupal error messag

Events happening in the community are now at Drupal community events on www.drupal.org.
SalvadorHouser's picture

In a form, if user is anonymous user ($user->uid == 0), I use drupal_set_message('my error message', 'error') to set an error message at cs4you.net and the form displays a field with a text to encourage registration. If the user is not anonymous, the form displays some other fields.

When an anonymous user visits the page, sees the error message, logs in, and becomes authenticated user, the form display changes correctly, but the drupal error message I set earlier seems to persist. When I ask the browser to reload the page or clear the cache, the error message goes away. Which function do I need to call in my form to clear the error message automatically?

Drupal Developers India

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: