I am using Webform in conjunction with Webform Block, using the form as a block and displaying the block in the content bottom region of nodes of a specific content type. The content of the nodes are travel arrangements and the form should allow the user to send a booking request with the form.
What I would like to achieve is that the title of the node (the destination) should be automatically loaded into a field of the form ("Betreff:" in the screenshot). So if the title of the node is "Seefestspiele Mörbisch", this title should be loaded into the field "Betreff:" and submitted by email.
I have tried to work with %get[title] as a standard value for the form but it did not work.
Any suggestions?
Comment | File | Size | Author |
---|---|---|---|
Seefestspiele Mörbisch | EINSTERN - TESTUMGEBUNG1.png | 418.03 KB | criscom |
Comments
Comment #1
criscommaybe you could help me out with a comment or two. I am no PHP expert and struggling...
Comment #2
criscomComment #3
criscomnobody there with just a faint hint or something????
Comment #4
quicksketchThis currently isn't possible without custom coding (as far as I know). The only way I can think of doing it is using the additional processing code to check the current URL, loading the node, then setting the value of a field. However I don't provide support on how to write custom code in the Webform issue queue. See http://drupal.org/handbook/modules/webform/submission-code
Comment #5
vernond CreditAttribution: vernond commentedTry something like this in the "additional validation" processing block:
Comment #6
criscomThanks quicksketch and vernond for your help. I'll try out your suggestions and report back!
Comment #7
loophole080 CreditAttribution: loophole080 commentedtry the prepopulate module http://drupal.org/node/228167 - i've found it very handy, though i haven't used it with webform - but it's supposed to work see http://drupal.org/node/587306
Comment #8
pontus_nilssonI solved it by using a hook_form_alter() in my custom module. It looks like this:
If additional processing does it, I would go for that instead.
You can find YOURWEBFORMID by doing a
dpm($form_id);
beforeswitch ($form_id) {
if you have the Devel module installed. Or just use print_r($form_id);In my case I had a hidden field with the node title inserted.
Comment #9
quicksketchComment #10
Sinan Erdem CreditAttribution: Sinan Erdem commentedsubscribing...