Closed (fixed)
Project:
Webform
Version:
4.7.x-1.x-dev
Component:
User interface
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
18 Jan 2007 at 07:00 UTC
Updated:
26 Oct 2009 at 18:12 UTC
I'd like to be able to capture the page a user was on when they clicked the Contact form I created with webform and include it as a hidden field. As is, the referer always says the webform itself.
Is this possible, or am I asking for a new feature?
Comments
Comment #1
ullgren commentedIf you are running on a Apache webserver you can add a hidden field with the value $_SERVER["HTTP_REFERER"].
Other webservers might not support this environment variable since it not strictly a CGI 1.1 requirement.
Also if I remember correctly this taken from the browsers request so I might be forged by a bot or even left out depending on the browser implementation/security setting in the browser.
Comment #2
eliza411 commentedThanks for that suggestion. I tried it, and I apologize if I'm being dense, but I can't make it work.
When I create a hidden field, as you suggest, with the value $_SERVER["HTTP_REFERER"], all it passes to the results is the literal string $_SERVER["HTTP_REFERER"] I must be missing something.
When I create a variable on the webform itself and assign it a value $_SERVER["HTTP_REFERER"] I can echo the value I want, but I don't know how to pass it to the webform results. I put the following in the Description field:
and I see the URL I want. I try to create a hidden field with the value $referer, and I just get the literal $referer.
I don't mind that the referrer can be forged or might be missing. With sitewide forms our users will often assume you know what they're looking at when they write their message, but we can't figure out what they mean unless we know where they were. On the pre-drupal site, just passing that value made it so much easier to respond to their comments and requests.
Comment #3
eliza411 commentedI will try upgrading to the latest version of webform and see if that makes a difference.
I've been using // $Id: webform.module,v 1.61.2.10 2006/07/14 19:25:26 ullgren Exp
Comment #4
eliza411 commentedNope, upgrading didn't change the behavior.
Comment #5
quicksketchPut the following in as the default value for a hidden input.
Comment #6
ullgren commentedYes sorry about that, it should be just as quicksketch wrote.
Comment #7
ullgren commentedJust tried this my self and it seems to be a bug somewhere.
I keep getting the URL to the node itself in the referrer field even if the filed has an other value when viewing the HTML source of the rendered form.
Comment #8
eliza411 commentedYeah, the %server[HTTP_REFERER] was the first thing I tried and an obvious choice, but when it didn't do what I expected, I thought perhaps there was some other intention with that field.
Sorry I didn't file it as a bug report in the first place.
Comment #9
quicksketchThis works correctly now in 5.x version. I'm no longer supporting 4.7. I'd advise an upgrade now that every module that will be ported to 5 has already been ported. With D6 on the horizon, it doesn't make sense to be supporting 3 branches.
Comment #10
(not verified) commentedComment #11
Valeratal commentedHow capture the actual title of node - referer ?