0

I've got a Drupal 8 webform with a multi page wizard. I know that it is possible to "jump" to a specific page if I implement hook_webform_submission_form_alter() and add my own submit function to change the formState current_page to my desired page. But I want to check a value from a previous page and if the value is value_a I want to submit the form. If it is value_b I want to go to page b and if its value_c I want to go to page c.

$pages = $formState->get('pages');

if ($formState->get('type') === 'value_b') {
    $pageName = 'page_b';
    gotoStep($pageName, $pages, $formState); // this is my custom function to go to the desired page
} else if ($formState->get('type') === 'value_c') {
    $pageName = 'page_c';
    gotoStep($pageName, $pages, $formState); // this is my custom function to go to the desired page
} else {
    // SUBMIT FORM. HOW TO DO THIS?
}
  • Can you not call submitForm or the Webform equivalent? api.drupal.org/api/drupal/… – Kevin Sep 2 '17 at 16:05
  • The latest dev release of the Webform module for Drupal 8 includes conditional logic support to hide/show (aka skip) wizard pages – jrockowitz Sep 3 '17 at 2:01
  • @jrockowitz Sounds great. I will have a look at it. – mAtZ Sep 3 '17 at 6:50
0

I switched to the latest dev release ob the webform module and could skip the wizard pages depending on previous values without having to code anything. Thanks for the tip @jrockowitz ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.