2

Using D8 to create a node based on a Webform named "White Paper". I have a hidden field on the webform named white_paper_title.

When creating a node based on this form, I've added the following in the Default webform submission data field, like so:

white_paper_title: 'something'

This works fine if I base the new node on Webform, and select "White Paper" from the list.

The problem is that it never works when I create a new content type based on the White Paper webform. When viewing the node in the browser, the hidden field is there, but the value is never plugged in. How do I get this working?

5
+50

You can pass a field's value as a token to the webform.

You would need to add 'field_white_paper_title' to your webform node and then change the "Default webform submission data (YAML)" to

white_paper_title: [webform_submission:node:field_white_paper_title]
  • But will the [webform_submission] have anything in it before the webform is submitted by the visitor? – croceldon Jan 3 '17 at 16:23
  • The [webform_submission:node:*] token is not pulling data from the submission but the node that submission is being posted from. – jrockowitz Jan 4 '17 at 13:14
  • I still have the problem about why I can pass YAML to a node based on a general Webform, but not on a node based on my particular webform. – croceldon Jan 4 '17 at 16:23
  • Yep that is a bug. It took me second to understand that a custom webform was not working as expected. I created this issue drupal.org/node/2841583 on D.O to address the problem. – jrockowitz Jan 6 '17 at 12:53
  • This issue has been fixed. (drupal.org/node/2841583) Please download or checkout the latest dev release. – jrockowitz Jan 6 '17 at 16:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.