How can I get the form validated with AJAX?
Here is a very basic example that will validate your data. It should give you an idea of how to handle it:

class myForm extends FormBase
{
  public function getFormId()
  {
    return 'my_form';
  }

  public function buildForm(array &amp;$form, FormStateInterface $form_state)
  {
    $form['#prefix'] = '&lt;div id="my_form_wrapper"&gt;';
    $form['#suffix'] = '&lt;/div&gt;';
    $form['some_text'] = [
      '#type' =&gt; 'textfield',
      '#title' =&gt; $this-&gt;t('Enter a value'),
    ];

    $form['submit'] = [
      '#type' =&gt; 'submit',
      '#value' =&gt; $this-&gt;t('Submit'),
      '#ajax' =&gt; [
        'wrapper' =&gt; 'my_form_wrapper',
        'callback' =&gt; '::ajaxCallback',
      ],
    ];

    return parent::buildForm($form, $form_state);
  }

  public function validateForm(array &amp;$form, FormStateInterface $form_state)
  {
    if($form_state-&gt;getValue('some_text') != 'Awesome')
    {
      $form-&gt;setValue('some_text', $this-&gt;t('Please enter "Awesome"'));
    }
    parent::validateForm($form, $form_state);
  }

  public function ajaxCallback(array &amp;$form, FormStateInterface $form_state)
  {
    return $form;
  }

  public function submitForm(array &amp;$form, FormStateInterface $form_state)
  {
    drupal_set_message($this-&gt;t('The form was submitted'));

    parent::submitForm($form, $form_state);
  }
}


With the above code, the form is built, and the ajax is set. Note that no validation needs to be set, as the validateForm() method will be called automatically if it exists. When the ajax is executed, it will always call the validate form method first. If validation is passed, then the submitForm() method will be called, but if validation is failed, it will not. Finally the ajax callback is called and the form is returned.