How to set multiple error messages with form_set_error? I notice I can pass in a message variable to form_set_error().

How can I pass in multiple messages?

I tried calling form_set_error() several times, but always the first one is displayed.

So, to sum up I want to show something like this:


error 1
error 2
error 3


Currently, I can only get:


error 1


Then, once the users correct it, and resubmit it, they get:


error 2

if (strpos($form_state["values"]["body"], "

if (strpos($form_state["values"]["body"], "


If both of these control statements trigger an error, only the first one is shown.
After the user corrects the error, the second error message is shown.
I would change the code to issue a single call to form_set_error() per element:

$errors = array();
if (strpos($form_state["values"]["body"], "&lt;h1") === true)
    $error_messages["body"][] = "Blalalabalbal bablalbabla.";

if (strpos($form_state["values"]["body"], "&lt;h3") === false)
    $error_messages["body"][] = "Do this do that balbablalba.";

foreach ($error_messages as $element =&gt; $messages) {
    form_set_error($element, theme('item_list', array('items' =&gt; messages)));
}