hi
thanks for a great module.
I know my question sounds similar to other questions posted earlier, however their answers don't seem to fully satisfy my needs.

I have a form integrated into a block which sits in content-bottom. If i use the %title token i just get the page title for the form-page (which is pretty obvious) however i would like to be able to see the parent page title instead of the form page title.

Since my page has been integrated into another page i cannot work with referrer id's etc...

Your help is greatly appreceiated.

Comments

quicksketch’s picture

I don't think what you're requesting is currently possible within the configuration of a Webform. The only possible way you could do this using custom PHP code. Where is it that you want to display the title of the "parent" node? As a default value for a field or in a markup area or something else?

br4t’s picture

I'd like to use it as the title for an email (this form was submitted through: pagetitle). Since i use the same form for multiple pages, i want to know what page it was submitted from.

I guess this would be the default value for a hidden field?

br4t’s picture

Any ideas?

quicksketch’s picture

No, I don't think this is currently possible within Webform. You'd need to code a custom module that implements hook_form_alter() to achieve this goal.

Marko B’s picture

I would also like to have this option, to pass node title or in fact page title to some field in webform. As i intend to "attach" webform to some other node, which i would say is pretty standard behaviour to have contact under some page. Did someone do this hook?

p.morin’s picture

Hi,

I've the same problem and I use a little custom PHP code.

I put the value of 'q' in a hidden field.
In 'Advanced parameters', I put my custom PHP code to load the node with the value of my hidden file and I overwrite the value.
In my case, I just want to overwrite a field printed in the email's body. Maybe you can overwrite the email's subject with codes in 'Advanced parameters'

Marko B’s picture

Do u mean "Webform advanced settings->Additional Processing:" under configuration of webform as i dont see any adv. param to choose. Can u post code you used for loading node and changing field in emails body?

matteoraggi’s picture

Problem solved? someone have some sample code to add http referrer into hidden fields of webform or something similar, just to know from which page was coming people filling and sending the webform?

p.morin’s picture

Hi,

This is the code I'd use:

$tabNode = $form_values['submitted_tree']['type_de_gestion'];
$tabNode = explode("/",$tabNode);
$myNode = node_load($tabNode[1]);
$form_values['submitted'][10] = 'Soumission du formulaire : '.$myNode->title;

'type_de_gestion' contains the Drupal path (like node/xxx), I put this value with the default value in the definition of my field (%get[q])

Anonymous’s picture

Thanks Sigfried that works well for me. When submitted I get node/xxx. What I need is this to show the page title. I've been hacking away and can't find solution. Can you please provide an alternative snippet to give this result? Much appreciated.

In response to #7, the snippet should be inserted into "Webform advanced settings - Additional Validation"

p.morin’s picture

The page title contains node title + site name, you need to use variable_get()

$tabNode = $form_values['submitted_tree']['type_de_gestion'];
$tabNode = explode("/",$tabNode);
$myNode = node_load($tabNode[1]);
$form_values['submitted'][10] = 'Soumission du formulaire : '.$myNode->title.' | '.variable_get('site_name','');

This code can fix your problem? If not, can you give me an exemple of your page title?

In response to #7, I put my code in "Webform advanced settings->Additional Processing:". With the superduperdan's response, we can say it's work in both cases.

chrisbeaman’s picture

Here's my solution:

First I installed the Webform Block module. I went into my Webform advanced settings and chose "Generate Block." I then went to my block administration page and enabled this block in my sidebar. Finally, in the components section of my webform, I added a hidden field and assigned it the value: %server[REQUEST_URI].

That's it! Now, whenever anyone submits my form, I see the page URL -- not the node number -- that they submitted from.

So for example:

Name: John Doe
Email: johndoe@email.com
Page Title: /page-that-john-doe-contacted-me-from

Anonymous’s picture

Sigfried,

Thanks for the code. I tried inserting it and it still gives me a "node/81" which tells me that it's not getting the title of the node itself. For example, I create a new content type. In the content type's edit page, the "title" cck field is the one that I want to have as the a hidden field, lets say the field is called "job_description".

so when the email is processed, if the user is on "Web Developer" job application page, the email will send the site administrator the following, once completed:

First Name: Sig
Last Name: Fried
Job Description: Web Developer
Résumé: Download.pdf

The reason I am trying to do this, is because I have the block appearing on several nodes, and generated automatically every time a "career" page type is published, so I would like the block to grab the "node title" and replace the default value of the hidden "job description" field with the "node title". Essentially, I've made it so that the Node title is the actual name of the job these people would be applying for.

Can you rewrite it to grab the code from the node->$title?

Anonymous’s picture

anyone?...

I still can't seem to get a hidden subject field to be populated with the page title in the webform block...

appreciate any assistance.

Raff.

matteoraggi’s picture

I skipped this problem using the author contact module and it automatically send you the url of compiled form.

quicksketch’s picture

Status: Active » Closed (fixed)

Any further inquiries: I'd suggest requesting this feature as part of the Webform Block module.

matteoraggi’s picture

This is the right link to webform block:
http://drupal.org/project/webformblock
the discussion is being moved here:
http://drupal.org/node/665960

pelusian’s picture

@chrisbeaman Tnx, I found your post very very useful, in drupal 7 I created a textfield and put as default value %server[REQUEST_URI] . I have one question: in the email it prints Page Title: /page-title, is there a way to only display Page Title: page-title, without "/"?
Tnx in advance for your help.

mrandy’s picture

yep chrisbeaman's solution in #12 worked perfect for me. I just gave the hidden field a label of "Reffering URL" and put the %server[REQUEST_URI] into the field value and bingo.

Thanks a lot Chris.

Andy