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

quicksketch’s picture

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

Collins405’s picture

Did 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 []?

Collins405’s picture

I didn't realise i was using version 3 of webform, a quick update to 4, and everything worked perfectly.

quicksketch’s picture

Issue summary: View changes
Status: Active » Closed (fixed)

I didn't realise i was using version 3 of webform, a quick update to 4, and everything worked perfectly.

Oh great! Thanks for the followup.