how to check in ajax form callback if form for failed validation I have a form and on and implemented a ajax submit callback which calls this function:

function popover_ajax_callback($form, &amp;$form_state) {
    // watchdog("ajax_callback", "testing ajax callback", array(), WATCHDOG_ALERT);
    return '&lt;div id="ajaxchanger"&gt;' . $form_state['values']['first']['field_firstname'] . '&lt;/div&gt;';
}


How do I check if the form failed or passed validation within this function?
function popover_ajax_callback($form, &amp;$form_state) {
  $errors = form_get_errors();
  if( $errors ) {
    // error detected, do something
  } else {
    // everything is ok
  }
}


but your return value is not ok. You need to return an renderable array. You may want to try someting like this:

return array('#markup' =&gt; '&lt;div id="ajaxchanger"&gt;' . $form_state['values']['first']['field_firstname'] . '&lt;/div&gt;');