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.
Comment | File | Size | Author |
---|---|---|---|
Screenshot 2021-12-03 at 19.09.48.png | 34.14 KB | HeikkiY | |
webform_confirmation_url_query_parameters.yml | 4.71 KB | HeikkiY |
Issue fork webform-3252502
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:
Comments
Comment #2
HeikkiY CreditAttribution: HeikkiY commentedComment #3
HeikkiY CreditAttribution: HeikkiY commentedComment #4
HeikkiY CreditAttribution: HeikkiY commentedComment #5
paulocsWorking on it.
Comment #7
paulocsActually 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 themergeOptions()
method.Comment #8
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedSince 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
Comment #9
paulocsComment #10
paulocsComment #13
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedComment #14
Anonymous (not verified) CreditAttribution: Anonymous commentedI 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