Problem/Motivation

It seems like the recent change in https://www.drupal.org/node/3247813 creates a regression when you want to include custom query parameters in the confirmation path. These are easily available as tokens in the Confirmation URL settings but are now removed.

EDIT:
I played around with the settings and noticed that if you add a forward slash to the beginning of confirmation URL, it then works correctly. Maybe it might be beneficial if there would be a validation for the confirmation URL or at least a help text to say that of course it needs to be a valid route.

Original issue:

At the moment I have the following query string parameter in a custom confirmation path:
confirmation?submission_id=[webform_submission:sid]

With version 6.1.0 it works correctly but with 6.1.1 it replaces the custom query parameters with the original query parameters.

In our case this creates a regression since we want to get the created webform submission ID in the confirmation page and fetch data from it.

Could this be made as optional setting that original query parameters are replacing custom query parameters?

It seems like jrockowitz did test it should keep the query parameters intact but it seems like its not working.

If I test this with the attach webform I get redirected to the following URL:
form/test?token=uFUjTjf3aaYH5Ljpv4B9yjqmWYiKWGpKmlqRmHbOtAg&webform_id=test

But at the same I get the error:
Confirmation URL confirmation?submission_id=784 is not valid.

So it does seem like it knows the submission_id query variable but still redirects to a different query parameters with the token and webform_id in the URL.

Steps to reproduce

Attached is a webform with a confirmation URL with query parameters. These are removed when the form is submitted and replaced with new query parameters.

Proposed resolution

The query parameters should remain intact if they are available in the confirmation path or these should be optional in the confirmation URL settings.

Issue fork webform-3252502

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

HeikkiY created an issue. See original summary.

HeikkiY’s picture

Issue summary: View changes
HeikkiY’s picture

Issue summary: View changes
HeikkiY’s picture

Issue summary: View changes
paulocs’s picture

Assigned: Unassigned » paulocs

Working on it.

paulocs’s picture

Assigned: paulocs » Unassigned
Status: Active » Needs review

Actually the problem is not the slash. The code changed in #3247813: [Confirmation] Query string parameters aren't added using custom path overrides the URL options because the method setOptions() is called instead of the mergeOptions() method.

jrockowitz’s picture

Since this is a regression we should add a little test coverage to prevent this from happening again.

@see webform/tests/src/Functional/Settings/WebformSettingsConfirmationTest.php

paulocs’s picture

Assigned: Unassigned » paulocs
Status: Needs review » Needs work
paulocs’s picture

Assigned: paulocs » Unassigned
Status: Needs work » Needs review

  • jrockowitz committed 91bb17c on 6.1.x authored by paulocs
    Issue #3252502 by paulocs, HeikkiY: Upgrading to Webform 6.1.1 removes...

  • jrockowitz committed 91bb17c on 6.x authored by paulocs
    Issue #3252502 by paulocs, HeikkiY: Upgrading to Webform 6.1.1 removes...
jrockowitz’s picture

Status: Needs review » Fixed
Anonymous’s picture

I am trying to use a token within the Confirmation page URL itself, i.e. not as a query string parameter, and have a related problem. (The reason is to pass a CiviCRM User Id as contextual filter to a Drupal View.) This is using Webform 6.1.2.

The URL is configured as:
/thank-you/[current-user:civicrm-contact:id]
(This was copied from our Drupal 7 implementation - I can't see an available tokens reference on Drupal 8)

The URL resulting from this is:
https://mysite.org.uk/thank-you/?token=XlZ2kIPwKRYGUNkbh80zvBChzK5lqL6f800-1gWsq6Q
when I am expecting:
https://mysite.org.uk/thank-you/244

Status: Fixed » Closed (fixed)

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