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
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
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.