Multistep example: move to specific step programatically

With the functions multistepMoveToStep and multistepMoveToStepWithValidation it’s possible to skip to the last (or any other) step of the form at once.

Form

    Step 2

    step. Nothing much here. You should have skipped while you had the chance.

    Step 3

    Third step. Nothing much here. You should have skipped while you had the chance.

    Step 4

    Fourth step. Nothing much here. You should have skipped while you had the chance.

    Step 5

    Final step. Please submit!



    Form Code

    [step]
      <label for="txt">Enter some text*</label>
      [text* txt id:txt]
      <a href="#" class="skip-to-last">Skip to the last step. (without triggering validation)</a><br>
      <a href="#" class="skip-to-last-with-validation">Skip to the last step. (with validation)</a><br>
    [step]
      step. Nothing much here. You should have skipped while you had the chance.</p>
    [step]
      <p>Third step. Nothing much here. You should have skipped while you had the chance.</p>
    [step]
      <p>Fourth step. Nothing much here. You should have skipped while you had the chance.</p>
    [step]
      <p>Final step. Please submit!</p>
      [submit]
    <script>
      (function($){
          $form = $('.wpcf7-form');
          $form.click(function(e){
              const $clickedElement = $(e.target);
              if ($clickedElement.hasClass('skip-to-last')) {
                  wpcf7cf.multistepMoveToStep($form, 5);
                  return false;
              }
              if ($clickedElement.hasClass('skip-to-last-with-validation')) {
                wpcf7cf.multistepMoveToStepWithValidation($form, 5);
                return false;
              }
          });
      })(jQuery)
    </script>

    Conditional Fields (Text)