1

I have created a multistep webform and it has 5 steps. is it possible to get the previous step field value/data in the next step? for example, I have a field select list field (key = select_your_data_type) in step 4 and on step 5 show the selected field value?

2

Use

HOOK_form_alter(array $form,FormStateInterface $form_state, $form_id)

check if $form_id equals your specific form (form's machine name) and validate if current page is page where you want to display data ('step_5' is wizard's page machine_name).

if ($form['progress']['#current_page'] === 'step_5')

get values from $form_state

$form_state->getValue('select_your_data_type')

and you can set form elements via

$form['elements']['page_5']['field_i_want_to_set_in_page_5']

or via

$form_state->set('field_i_want_to_set_in_page_5', $my_value);

or course do not forget to print field_i_want_to_set_in_page_5 somewhere on page 5.

1

Look into the computed twig element of webform You can access the values of data.name_of_field with that

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.