Custom form using custom template, submit the form don't call its validate and submit handlers I created a simple custom module where I created a Class Form using a custom template form. If I don't use my custom template (I comment my _theme hook from my .module), when I submit my form, class methods handlers validate and submit are called. But When I use my custom form template, If I submit my form, validate and submit class methods handlers aren't called, I don't understand why.

This is my code; I begin with my templates/form--myformtest-form.html.twig template. 

&lt;h1&gt;TEST&lt;/h1&gt;
&lt;form{{ element }}&gt;&lt;/form&gt;


My myformtest.module code is the following. 

/**
 * Implements hook_theme().
 */
function myformtest_theme($existing, $type, $theme, $path)
{
  return array(
    'form__myformtest_form' =&gt; array(
      'render element' =&gt; 'form',
      'template' =&gt; 'form--myformtest-form',
    ),
  );
}


If I comment this hook, my form use the default theme form template. In this case, submit the form call validate and submit class handlers methods. If I don't comment this hook, my form use my custom template. Then when I access to my custom form page and valid the form, validate and submit handler are never called.

This is the simple code from my src/Form/MyformtestForm.php class.

class MyformtestForm extends FormBase {
  //...
  public function buildForm(array $form, FormStateInterface $form_state) {
    $form['textfieldtest'] = [
      '#type' =&gt; 'textfield',
      '#title' =&gt; $this-&gt;t('textfieldtest'),
      '#maxlength' =&gt; 64,
      '#size' =&gt; 64,
    ];

    $form['submit'] = [
        '#type' =&gt; 'submit',
        '#value' =&gt; t('Submit'),
    ];

    return $form;
  }

  public function validateForm(array &amp;$form, FormStateInterface $form_state) {
    ksm("MyformtestForm Validate handler!");
    // logs never displayed when I use my custom template. If I don't use the custom template, this log appears.
  }

  public function submitForm(array &amp;$form, FormStateInterface $form_state) {
    ksm("MyformtestForm Submit handler");
    // logs never displayed when I use my custom template. If I don't use the custom template, this log appears.
  }


Why handlers aren't called when my form use my custom override? How can I call them?

These are the variables existing from my custom template when I load my form page.
You need "base hook" in there, I believe.

Here's an example:

/**
 * Implements hook_theme().
 */
function formcustomtemplate_theme() {
  return array(
    'form__my_form_test' =&gt; array(
      'render element' =&gt; 'form',
      'template' =&gt; 'form--myformtest-form',
      'base hook' =&gt; 'form',
    ),
  );
}


If you are using a custom theme, and you don't need the template in your module, the approach of creating a new theme hook for your custom form is unnecessary.
Rather than create a new theme hook, use hook_theme_suggestions_alter in your theme:

/**
 * Implements hook_theme_suggestions_alter().
 */
function mytheme_theme_suggestions_alter(array &amp;$suggestions, array $variables, $hook) {

  if ($hook == 'form' &amp; !empty($variables['element']['#theme'])) {
    $suggestions[] = 'form__' . $variables['element']['#theme'][0];
  }

}


then create the appopriate template in your theme.

then to see the theme suggestions output to the page, turn on twig debugging:

https://drupalize.me/blog/201405/lets-debug-twig-drupal-8

You'll see template suggestions in the markup:

&lt;!-- FILE NAME SUGGESTIONS:
   * form--myformtest-form.html.twig
   x form.html.twig
--&gt;


You can see that it's not yet picking up your template, so create a template file by copying the form.html.twig and renaming it.

To check where Drupal is looking for templates using the "form" hook, you can print out the theme registry from hook_theme_registry_alter:

 "form" =&gt; array:6 [▼
    "template" =&gt; "form"
    "path" =&gt; "themes/custom/mycustomtheme/templates/form"
    "type" =&gt; "theme_engine"
    "theme path" =&gt; "themes/custom/mycustomtheme”
    "render element" =&gt; "element"
    "preprocess functions" =&gt; array:4 [ …4]


This lets you know that you need to put the template in that directory.