Display error message when validating form in a specified region or div I have a Drupal 7 form, built by using Form API. I just want to validate using the hook_form_validate function, and if there are errors, display them using drupal_set_message. It is working perfectly. The problem is that in another page, I have the same form in a div, in the left side of the page, and would want the error message to appear in this region only, and not at the top of the page, where now it is appearing (that is controlled in page.tpl.php via $message variable, I think). Any idea of how could I achieve this easily?
If you use the form_set_error function instead of drupal_set_message, then the error message will be displayed within the form, which would mean that it would display inside your block.

If you would like to retain the drupal_set_message behaviour for your main form page then you would either need to differentiate which method is called in the validation based on url (or Context), or provide two separate forms so that you can simply validate each separately. In this instance you could build form and validate using a shared function to avoid duplication.