function AutoTextFields::submitForm

Same name in other branches
  1. 3.x modules/ajax_example/src/Form/Autotextfields.php \Drupal\ajax_example\Form\Autotextfields::submitForm()
  2. 8.x-1.x ajax_example/src/Form/Autotextfields.php \Drupal\ajax_example\Form\Autotextfields::submitForm()

Overrides FormInterface::submitForm

File

modules/ajax_example/src/Form/Autotextfields.php, line 103

Class

AutoTextFields
Adds more text fields basing on AJAX-enabled checkbox clicks.

Namespace

Drupal\ajax_example\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
    $this->messenger()
        ->addMessage($this->t('Submit handler: First name: @first_name Last name: @last_name', [
        '@first_name' => $form_state->getValue('first_name', 'n/a'),
        '@last_name' => $form_state->getValue('last_name', 'n/a'),
    ]));
}