Notice removed Draw attention by user2137454
    Bounty Ended with oknate's answer chosen by user2137454
6 fixed a comma-splice sentence
source | link

Drupal 8, custom Custom form using custom template, submit the form don't call its validate and submit handlers

UP/ I added the content of variables existing from the template with {{ kint() }} (its a {{ dump() }} more practical ;) ) /UP

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,code; I begin with my templates/form--myformtest-form.html.twig template :.

My myformtest.module code :is the following.

/**
 * Implements hook_theme().
 */
function myformtest_theme($existing, $type, $theme, $path)
{
  return array(
    'form__myformtest_form' => array(
      'render element' => 'form',
      'template' => 'form--myformtest-form',
    ),
  );
}
// If I comment this _theme 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 the _theme 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.

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.

Why handlers aren't called when my form use my curtomcustom override  ? And howHow can I call them  ?

UP/ Variables These are the variables existing from my custom template when I load my form page : .

enter image description here

screenshot

Drupal 8, custom form using custom template, submit the form don't call its validate and submit handlers

UP/ I added the content of variables existing from the template with {{ kint() }} (its a {{ dump() }} more practical ;) ) /UP

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 :

My myformtest.module code :

/**
 * Implements hook_theme().
 */
function myformtest_theme($existing, $type, $theme, $path)
{
  return array(
    'form__myformtest_form' => array(
      'render element' => 'form',
      'template' => 'form--myformtest-form',
    ),
  );
}
// If I comment this _theme 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 the _theme 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 :

Why handlers aren't called when my form use my curtom override  ? And how can I call them  ?

UP/ Variables existing from my custom template when I load my form page :

enter image description here

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.

My myformtest.module code is the following.

/**
 * Implements hook_theme().
 */
function myformtest_theme($existing, $type, $theme, $path)
{
  return array(
    'form__myformtest_form' => array(
      'render element' => 'form',
      'template' => '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.

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.

screenshot

5 added 1 character in body
source | link

UP/ Variables existing from my custom template when I load my form page :

UP Variables existing from my custom template when I load my form page :

UP/ Variables existing from my custom template when I load my form page :

4 added 308 characters in body
source | link

UP/ I added the content of variables existing from the template with {{ kint() }} (its a {{ dump() }} more practical ;) ) /UP

I created a simple custom module where I created a Class Form using a custom template form.

Why handlers aren't called when my form use my curtom override ? And how can I call them ?

UP Variables existing from my custom template when I load my form page :

enter image description here

I created a simple custom module where I created a Class Form using a custom template form.

Why handlers aren't called when my form use my curtom override ? And how can I call them ?

UP/ I added the content of variables existing from the template with {{ kint() }} (its a {{ dump() }} more practical ;) ) /UP

I created a simple custom module where I created a Class Form using a custom template form.

Why handlers aren't called when my form use my curtom override ? And how can I call them ?

UP Variables existing from my custom template when I load my form page :

enter image description here

    Tweeted twitter.com/StackDrupal/status/781807905989427200
3 deleted 506 characters in body
source | link
    Notice added Draw attention by user2137454
    Bounty Started worth 50 reputation by user2137454
2 added 26 characters in body
source | link
1
source | link