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

sunshinee’s picture

If 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.

quicksketch’s picture

Status: Active » Closed (fixed)

Thanks @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.

hexabinaer’s picture

Issue summary: View changes

To 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

jamesfk’s picture

Hi 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

Mouse_Man_58’s picture

Any ideas on how to do this effectively in Drupal 9?