Problem/Motivation

When I create a multi-page webform with some pages conditionally skipped, tracking wizard progress in the URL set to "Page name" and drafts enabled, URL tracking doesn't work correctly - when I have a three-page webform with second page conditionally visible based on value entered on the first page, I get an URL for the third page on the second page.

Steps to reproduce

  1. Create a three-page webform with radios element on each page.
  2. Make second page to be visible conditionally based on the value of the radio element on the first page
  3. Enable saving of drafts
  4. Set "Track wizard progress in the url" to "Page name"
  5. Visit webform, on the first page select option, which makes second page vidible. Click Next button
  6. You'll see that you're on the second page, but URL matches the third one.

Example webform is attached.

Comments

milos.kroulik created an issue. See original summary.

jrockowitz’s picture

Status: Active » Needs review
StatusFileSize
new2.23 KB

Ouch, this issue is even noted in the source code.

https://git.drupalcode.org/project/webform/-/blob/6.x/js/webform.wizard....

There is a little JS above the comment that should have been fixing URL.

Please review the attached patch which should be backported to 8.x-5.x

milos.kroulik’s picture

Thanks. It seems to be working. Interestingly - there was a flick of the wrong URL before the correct one appeared.

I assume we need more reviews before RTBC.

jrockowitz’s picture

The flick of the wrong URL because the submit button is setting the form's action to the expected page and then conditional logic is changing the URL to a different page

The patch fixes the regression. Reworking the tracking behavior to not have the flicker (i.e. set the form's action) could impact existing installations.

Hopefully, someone will have time to provide a second review of the patch.

  • jrockowitz authored 95afa43 on 8.x-5.x
    Issue #3211736 by jrockowitz, milos.kroulik: "Track wizard progress in...

  • jrockowitz authored 95afa43 on 6.x
    Issue #3211736 by jrockowitz, milos.kroulik: "Track wizard progress in...
jrockowitz’s picture

Status: Needs review » Fixed

Since the solution is fixing a regression and easy to test, I committed the patch. If there any issue, please reopen this ticket.

jrockowitz’s picture

Webform logo This ticket was completed using Open Collective funds.
Please consider joining the Webform module's Open Collective to help ensure that the Webform module is maintained.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.