Required fields in form not validated I am currently constructing a form using an Ajax handler. The problem is that since i used Ajax, the submitting part is run without returning any error message. It is only when I clear the cache that all the errors appear (and the form disappear).

function My_Modile_form($form, $form_state, $arg){
     //constructing the form with REQUIREDfields
  $form ['submit'] = array (
      '#type' =&gt; 'submit',
      '#ajax' =&gt; array (
          'callback' =&gt; 'mymodule_form_ajax_callback',
          'wrapper' =&gt; 'result-div' 
      ),
      '#value' =&gt; t ( 'Lancer la simulation' ),
      '#weight' =&gt; 10000 
  );
}

function My_Module_form_validate($form_id, $form) {

  $form_numbers = array (
      'field_one',
      'field_two' 
  );
  foreach ( $form_numbers as $form_number ) {
    $numb = $form ['input'] [$form_number];
    if (! is_numeric ( $numb )) {
      form_set_error ( $form ['complete form'] [$form_number] ['#title'], 'ERROR !' );
    }
  }
}

function mymodule_form_ajax_callback($form, $form_state) {
  $form ['simul_message_retour'] += mymodule_form_submit ( $form, $form_state );
  return $form ['simul_message_retour'];
}

function mymodule_form_submit($form, $form_state) {
    // Submitting part
}


Has anyone met this issue before with Ajax forms ?

Thank you,

EDIT: I just found that  the hook_form_submit is called BEFORE the hook_form_validate
Here you have the framework for Form-handling:

function customregister_custom_form($form, &amp;$form_state){
  $form['first_name'] = array(
    '#title' =&gt; t('Vorname'),
    '#type' =&gt; 'textfield',
    '#default_value' =&gt; '0',
    '#required' =&gt; TRUE
  );
  $form['last_name'] = array(
    '#title' =&gt; t('Name'),
    '#type' =&gt; 'textfield',
    '#default_value' =&gt; '',
    '#required' =&gt; TRUE
  );
  $form ['submit'] = array (
    '#type' =&gt; 'submit',
    '#ajax' =&gt; array (
    'callback' =&gt; 'customregister_custom_form_callback',
      'wrapper' =&gt; 'customregister-custom-form'
    ),
    '#value' =&gt; t ( 'Lancer la simulation' ),
    '#weight' =&gt; 10000
  );
  return $form;
}

function customregister_custom_form_validate($form, &amp;$form_state) {

  if (! is_numeric ( $form_state['values']['first_name'] )) {
    form_set_error ( 'first_name', 'ERROR !' );
  }
  if (! is_numeric ( $form_state['values']['last_name'] )) {
    form_set_error ( 'last_name', 'ERROR !' );
  }
}

function customregister_custom_form_callback($form, &amp;$form_state) {
  drupal_set_message('custom_form_callback');
  //customregister_custom_form_submit($form, $form_state);
  $formular = drupal_get_form('customregister_custom_form');
  $formular = render($formular);
  return $formular;
}

function customregister_custom_form_submit($form, &amp;$form_state) {
  drupal_set_message('custom_form_submit');
}