I need to skip step 1 and start on step 2 of a multi-step/wizard webform when a certain condition is true.

I found documentation regarding this, How to programmatically skip steps in wizard forms

The key part being in hook_form_alter putting

$form_state->set('current_step', $all_keys[$goto_destination_step_index-1]);

What this does is fool drupal into thinking you're currently in the previous step that you want to go to, when in reality you're not. But the problem with this solution, is that it only works when you click the "next step" button and not on page load. Thus, the above solution only works for all but the first step.

I have tried doing

$form['progress']['#current_step'] = 'step_2';

But all this does change the progress marker to step 2, but I still see step 1's form.

I need to find a way to fool Drupal into thinking that I have completed step 1.

I tried doing $form_state->set('form_field' $value); when I looked at form_state->getValues(); they were not set. I so I set them with $form_state->getValues()['form_field'] = $value; on all step 1 fields, but doing this alone does not trick Drupal.

There must be somewhere were Drupal stores that step 1 has been completed, but haven't been able to figure out where. My guess would be somewhere on $form_state, but I have not found it yet.


I don't really need the answer to this anymore, as the condition is no longer needed so it was decided to remove the question's step 1 altogether. But if you happen to know the answer, feel free.

  • Seems like there isn't a way, your best bet would be to create a new form.
    – No Sssweat
    Dec 11, 2018 at 20:53

2 Answers 2


You can autosubmit step1 using JavaScript and it will direct user to step2. You can use Drupal behaviour so that no one can see step1.

  • I was looking for a non javascript solution, but +1 anyways. I was going to use this as a last resort.
    – No Sssweat
    Jun 17, 2018 at 3:15

You can use two submit functions- First submit will use for skipping without validating the current form step and second submit will use the validation and send the users to next step

  • I need to skip step 1 and start on step 2, altering submit function is not going to solve this. By "skip", I meant, not see step 1 at all and start on step 2. I didn't want them to see step 1 and have to click next.
    – No Sssweat
    Jun 15, 2018 at 23:44
  • Please confirm what is use of step-1 if it is not needed and user directly need to see step-2 Jun 16, 2018 at 2:00
  • yes, step one is not needed, I want the user to directly see step 2.
    – No Sssweat
    Jun 17, 2018 at 2:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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