Hi to All

In drupal required fields error messages does not follow drupal fields weight they show according to form array structure . So that by using the below code you can show error messages according to fields weight.

/

<?php
*
Implement of hook_form_node_form_alter(&$form, &$form_state)
*
*/
function
vv_error_ordering_form_node_form_alter(&$form, &$form_state) {
 
$fields = array();
  if(isset(
$form['title'])) {
   
$type = $form['type']['#value'];
   
$vtitle = variable_get('field_bundle_settings_node__'.$type);
   
$fields['title'] = $vtitle['extra_fields']['form']['title']['weight'];
  }
  if(isset(
$form['body'])) {
   
$fields['body'] = $form['body']['#weight'];
  }
 
$cckfields = array_values(preg_grep('#^field_.*$#', array_keys($form)));
  foreach (
$cckfields as $fieldname) {
    
$fields[$fieldname] = $form[$fieldname]['#weight'];
  }
 
asort($fields);
  foreach(
$fields as $f => $v) {
   
$data = $form[$f];
    unset(
$form[$f]);
   
$form[$f] = $data;
  }
}
?>