Ajax form submit - how to recognize if form contains errors in ajax callback?
You can define the form status in $form_state and check the status during rebuilding form.

Example code:

function activit_registration_form($form, $state) {

  if (isset($state['submit_success'])) {
    $form['ajax_form']['message'] = array("#markup" =&gt; t('Thanks for your submission.'));
  }
  else {

    $form["ajax_form"] = array(
      "#prefix" =&gt; "&lt;div id='registration-form-ajax'&gt;",
      "#suffix" =&gt; "&lt;/div&gt;",
    );

    // define form elements under 'ajax_form', such as
    // $form["ajax_form"]["element_1"] = array( ... );

    $form['ajax_form']["submit"] = array(
      "#type" =&gt; "submit",
      "#value" =&gt; t("Odoslať"),
      "#ajax" =&gt; array(
        "callback" =&gt; "activit_registration_form_ajax",
        "wrapper" =&gt; "registration-form-ajax",
        "effect" =&gt; "fade",
      ),
    );
  }

  return $form;
}

function activit_registration_form_ajax($form, $state) {
     return $form['ajax_form'];
}

function activit_registration_form_validate($form, &amp;$state) {
  $has_error = FALSE;

  if (!valid_email_address($state['input']['email'])) {
    form_set_error('email', 'email');
    $has_error = TRUE;
  }
  if (strlen(strval($state['input']['name']))&lt;3) {
    form_set_error('name', 'meno');
    $has_error = TRUE;
  }
  if (strlen(strval($state['input']['tel']))&lt;6) {
    form_set_error('tel', 'tel');
    $has_error = TRUE;
  }

  $state['submit_success'] = !$has_error;

  $state['rebuild'] = TRUE;
}