Double form submission on step #2 of multi step webform

Created on 13 June 2023, almost 2 years ago

Problem/Motivation

When using a multi step form with more than 2 steps, the form submission triggers twice on the 2nd step and empty the 1st step field value after reloading the page on the 3rd step.

Steps to reproduce

  1. Create a multi step form and add 3 pages on it.
  2. For each page, add a text field element and check the 2nd step text field as required.
  3. Create a custom module and add a webform_submission_form_alter hook on it
  4. Add a var_dump instruction with any text e.g var_dump('test'); into the hook
  5. Go to 'view' tab on the webform you just created.
  6. On the 1st step, the var_dump output should show only once, e.g. 'test'. Fulfill the field with any value on it and go to the 2nd step
  7. The var_dump output now shows twice. If you dump the $form_state object, you will notice different values on it: empty on the 1st dump, and on the 2nd dump, it shows all values
  8. On the 2nd step, fulfill the required field with any value and proceed to the next step
  9. The var_dump output is back to normal (showing only once) at the 3rd step
  10. Reload the page (send form data again)
  11. This will take the user back to the 2nd step, instead of the 1st one. The field value at this moment is correct
  12. Click on the previous button, and go back to the 1st step, and check the field value. It became empty
🐛 Bug report
Status

Active

Version

6.1

Component

Code

Created by

🇧🇷Brazil daniel_arend

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024