Score:1

Perform an action after each step in a multi-step Webform

in flag

I'm trying to figure out how to grab data from the previous step of a multi-step webform after a user progresses and I'm coming up blank.

Is there a particular hook that gets fired whenever a users progresses forward in a multi-step form or do I need to add a custom submit handler?

Thank you!

Score:3
in flag

I was able to get this working.

In my hook_form_alter() function I had to add a custom submit handler to the wizard_next action:

function my_module_form_alter(&$form, FormStateInterface $form_state, $form_id) {
    if($form_id == 'my_form') {
        $form['actions']['wizard_next']['#submit'][] = 'my_module_custom_submit';
    }
  }

function my_module_custom_submit(array $form, \Drupal\Core\Form\FormStateInterface $form_state) {
 // Custom submit behavior
}
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.