Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi
I've been following the tutorial
https://drupal.org/node/1760332
Would someone please check my video
please to see what I'm doing wrong?
http://www.youtube.com/watch?v=DoR7DegijX4&feature=youtu.be
I'll correct the video and hopefully help other people too
Many Thanks for your help
Comments
Comment #1
quicksketchHi Charlie, thanks for the extensive video describing your problem. A good question always should get a good answer. :)
So the problem you're experiencing is that the
[node:*]
tokens point to the *webform node*, not the current node whose page you're viewing. In your example, the Webform node is NID 2, while the node that contains the e-mail field is NID 1. I'm assuming that the Webform node (2) is being displayed as a block on the page of the Article node (1). So when Webform tries to convert the hidden field to its token value, it looks at the Webform node and doesn't find an e-mail field, so the token returns blank and no e-mail is sent.What you need to accomplish this unfortunately doesn't exist yet. You need a different token that uses the *current page node*, not the Webform node itself, when replacing the tokens. It hasn't been committed yet, but there is a patch you can use at #919760: Add a [current-page:object:?] dynamic token that extends the tokens module to add this support. I would suggest you patch the module in the mean time to add this support to Token module. Patching modules is okay as long as you keep track of which patches you've applied, so you can remove the patch when you next upgrade the module. See http://www.jenlampton.com/blog/sustainable-development-workflow-patching for a good guide on managing patches (there's also a link to documentation on applying patches in that article),
After applying that patch to token.module, you'll now have a token for
[current-page:node:field_email]
. If you use that token as your default value, it will have the effect you desire. I'd also suggest following that issue in the Token queue so you can keep track of when it gets committed to the main project.Comment #2
Collins405 CreditAttribution: Collins405 commentedDid the above work for anyone? I applied the patch, and added [current-page:node:field_business_e_mail] to the value of a hidden field, but when the email is sent, it just prints as [current-page:node:field_business_e_mail].
For the replacement tokens, they all seem to start with a %, am I doing something wrong by having the token in []?
Comment #3
Collins405 CreditAttribution: Collins405 commentedI didn't realise i was using version 3 of webform, a quick update to 4, and everything worked perfectly.
Comment #4
quicksketchOh great! Thanks for the followup.