The error|warning|status messages by default display on the top of page after validation of form or success submission, but sometimes you need to display this messages on the top of form, So the following code solve this issue:

/*
 * hook_form_alter()
 */

function MODULENAME_form_alter(&$form, &$form_state, $form_id) {
    if ($form_id == 'FORMID') {
        $form['#validate'][] = 'ie_form_validator';
    }
}

function ie_form_validator(&$form, &$form_state) {
    $form['ukife_form_validator'] = array(
        '#markup' => theme_status_messages(array('display' => 'error')), // you can use 'status', 'warning'   
        '#weight' => -1000,);
}

Comments

attar_eweev created an issue. See original summary.

m.attar’s picture

Issue summary: View changes
m.attar’s picture

Issue summary: View changes
Snater’s picture

Status: Reviewed & tested by the community » Closed (works as designed)

I do not see that being required by the Insert module as the Insert module provides a button that triggers JavaScript functionality only by attaching to some existing file/image field. There is no functionality provided by Insert that could trigger some message when saving the form.