willowf's picture

Hi everybody how are you

I have created a content type that has a link to a webform to fill in contact details.

But no token drags the information from which node the user comes to fill in the form.

Any solution.?

Note: I don't want to create a form for each node.

Accepted answer

Hey Willowf, I got it working on one of my sites using the following approach:

  • Create a webform.
  • Install a module which handles references, e.g. https://backdropcms.org/project/references .
  • Add a Node reference field to your content type, and allow to add references to  the Webform content type.
  • Go to Manage displays of the content type, configure to display the webform as "Rendered node".
  • Create a content item, and reference your webform.

Now, as your webform is displayed on the content page, you can make use of tokens as [current-node:title] and [current-node:field:field-my-field].

Most helpful answers

Hello again, and thanks for providing the screenshot! I guess it doesn't work because you're using standard node tokens like [node:field_tamano]. These don't work for the embedded webform.

To get such tokens for the webform, you have to choose a token from the section "Current page" (Tokens related to the current page request). Something like [current-node:field:field_tamano].

Comments

Thinking out loud... Maybe use the prepopulate module to prefill a hidden webform field?

Olafski's picture

Hey Willowf, I got it working on one of my sites using the following approach:

  • Create a webform.
  • Install a module which handles references, e.g. https://backdropcms.org/project/references .
  • Add a Node reference field to your content type, and allow to add references to  the Webform content type.
  • Go to Manage displays of the content type, configure to display the webform as "Rendered node".
  • Create a content item, and reference your webform.

Now, as your webform is displayed on the content page, you can make use of tokens as [current-node:title] and [current-node:field:field-my-field].

willowf's picture

Hello..
Thanks for your answer..

Ready the form, it comes out in the same node, it is not what I wanted but it is fine.

But there is a problem, there is no way for the token to save the information, it comes out as an empty field.

Olafski's picture

Strange! Where did you put the token? On my site, I've put it in the "Default value" field of a Webform text component.

(I've also checked the "Disabled" box in the component form to make the field non-editable.)

willowf's picture

Hello .. Yes, I did everything you said.

I have used all the tokens, but it does not recognize any from the node.

It recognizes other characters but not the data.
 

Olafski's picture

Hello again, and thanks for providing the screenshot! I guess it doesn't work because you're using standard node tokens like [node:field_tamano]. These don't work for the embedded webform.

To get such tokens for the webform, you have to choose a token from the section "Current page" (Tokens related to the current page request). Something like [current-node:field:field_tamano].

willowf's picture

It works now ...🎉🎉🎉
I have been with this for 3 days and I tried all the tokens, strangely now it works 😂😂

 

Really thank you very much