Add custom submission buttons to navigate through different wizard pages I need to navigate the user through different pages of a multistep webform. I have added additional submit button to the webform using following code.

function mymodule_form_alter(&amp;$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
if($form_id == 'mywebform_id') {
    $form['actions']['submit_button_step_1'] = array(
      '#type' =&gt; 'submit',
      '#value' =&gt; t('Go to Step 1'),
      '#submit' =&gt; array('custom_navigation'),
    );
    $form['actions']['submit_button_step_2'] = array(
      '#type' =&gt; 'submit',
      '#value' =&gt; t('Go to Step 2'),
      '#submit' =&gt; array('custom_navigation'),
    );
}
}


But now How could I navigate the user to the pages based on user clicks on which button?

I found this in community website. But not able to understand where should I put this code in my custom module.

How to programmatically skip pages in wizard forms
I used another more durty way. I just hide pages which must be skipped

function my_module_webform_submission_form_alter(array &amp;$form, FormStateInterface $form_state, $form_id)
{
  if (!isset($form['#webform_id']) || $form['#webform_id'] != 'my_form') {
    return;
  }

  $pages = &amp;$form_state-&gt;get('pages');

  if (some_statement) {
    $pages['skipped_page_name']['#access'] = FALSE;
  }
}


but it works only in forward direction. And if user clicks "previous page" it may cause unexpected behaviour. So you also need "show" pages again on each step:

$pages = &amp;$form_state-&gt;get('pages');
foreach ($pages as &amp;$page) {
  $page['#access'] = TRUE;
}