Form elements validation order I have a custom autocomplete field widget, defined like below:

/**
 * Implements hook_field_widget_form
 */
function mymodule_field_widget_form(&amp;$form, &amp;$form_state, $field, $instance, $langcode, $items, $delta, $element) {
  $element += array(
    '#id' =&gt; 'mymodule-field',
    '#type' =&gt; 'textfield',
    '#default_value' =&gt; '',
    '#autocomplete_path' =&gt; 'some/path',
    '#element_validate' =&gt; array('mymodule_autocomplete_validate'),
  );
  return $element;
}


I have a content type with 2 Term reference autocomplete fields: field foo with standard Autocomplete term widget (tagging) widget, and field bar with my custom autocomplete widget.

Field bar has a higher weight than field foo on a node form.

mymodule has weight 20 in system table. taxonomy module has weight 0.

However, when I submit a node form which includes both fields, mymodule_autocomplete_validate() is invoked earlier than taxonomy_autocomplete_validate(), so $form_state['values']['field-myfield-a'] is not processed yet.

The problem is I need to use the processed value of foo in mymodule_autocomplete_validate().

I have another 2 fields with same widgets but another names, and they are processed in the right order.

So the question is: how the order of execution of these functions is defined? Is there a way to change it?
hook_module_implements_alter() would seem to be the one you are looking for to change execution order.

However, I'm not sure It is exactly what you are looking for because it could have to do with the node edit form. One field could be higher on that form, and that could be causing the validation order issue. The weight of the fields on the form itself could be dictating the validation order. If that is the case, you can hook into the node form and run the validation in the order needed.