Closed (fixed)
Project:
Webform
Version:
7.x-3.9
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
6 Feb 2013 at 14:22 UTC
Updated:
27 Jan 2022 at 19:46 UTC
Jump to comment: Most recent
Is there a way to display in the results section what page referred a user to the webform? Or is it possible to populate data from fields into the webform (perhaps as a hidden field?) so the person who gets the submission knows where it should be filed? This way I only have to create one webform for this registration section I'm creating...
Thanks!
Comments
Comment #1
sunshinee commentedIf you have control over the url pointing to the webform, you can append a string like mydomain.com/page?source=7456 (using the Node ID) or mydomain.com/page/?source=PageTitle. Then grab that value by setting the webform component's default value to %get[source]. This is documented at http://drupal.org/node/296453
Hope this helps.
Comment #2
quicksketchThanks @rjoy. That's what I'd recommend for most cases too. In Webform 3.x you can also use %server[HTTP_REFERER] as a default value in a hidden field. In Webform 4.x, we need a generic token for referrer, I've made a request for this functionality at #2021969: Provide a token for [current-page:referrer].
Closing this issue after lack of original poster's response.
Comment #3
hexabinaerTo save time searching:
Seems like "copy this code to your custom module" is token's answer to this: https://www.drupal.org/node/2021969#comment-10717514
Comment #4
jamesfk commentedHi everyone,
Thanks to @helmo for the code on the other issue, which worked perfectly.
We needed this functionality for a couple of clients, so made a quick module that might be easier for anyone else needing this:
https://www.drupal.org/project/referrer_token
All the best,
James
Comment #5
mouse_man_58Any ideas on how to do this effectively in Drupal 9?