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(&$form, DrupalCoreFormFormStateInterface $form_state, $form_id) { if($form_id == 'mywebform_id') { $form['actions']['submit_button_step_1'] = array( '#type' => 'submit', '#value' => t('Go to Step 1'), '#submit' => array('custom_navigation'), ); $form['actions']['submit_button_step_2'] = array( '#type' => 'submit', '#value' => t('Go to Step 2'), '#submit' => 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
Sponsored by SupremePR