Hi,
I have created a webform called “Event Registration”.

I also created a content type “Event” with a webform field referencing the “Event Registration” webform.

Then I created some "Event" nodes and submitted some submissions. The webform results was tracking the “submitted to” very well.

I created a views page “Latest Events” that lists all the events (with event title field and the webform field).

The problem is:
when I use the views page to submit an “Event Registration” webform, the form is submitting, but when I check the webform submission “webform/manage/event_registeration/results/submissions” the “SUBMITTED TO” section is blank.

Also when I check Data (YAML) of the result, I found those also blank (entity_type: '' , entity_id: '') whereas the other submissions from normal nodes (The Event content type nodes) display “SUBMITTED TO” data properly (entity_type: node , entity_id: '113').

Another issue that I think it might be related to the previous one:

the webforms in views page (the previous page) do not receive [webform_submission:] tokens (like [webform_submission:node:nid], '[webform_submission:source-entity]', tec …) as default value for webform elements.

I hope I could make this clear.
Thanks for your help.

CommentFileSizeAuthor
#3 webform_fields_used_in-2859351-3.patch824 bytesjrockowitz

Comments

himalking created an issue. See original summary.

jrockowitz’s picture

This is very difficult edge case.

A webform looks at the current page for the source entity. A View can't be a source entity.

You could try to...

  • Write an entity alter hook and populate the source entity
  • Link to the event node
  • Link to the form and pass source_entity_type and source_entity_id as URL parameters.

I will look into passing the source entity to the submission form for the webform field.

I might be able to fix this but I am not promising anything.

jrockowitz’s picture

Priority: Major » Normal
Status: Active » Needs review
StatusFileSize
new824 bytes

Maybe the attached patch will solve your problem.

  • jrockowitz committed ffc2a99 on 8.x-5.x
    Issue #2859351 by jrockowitz: Webform fields used in views do not track...
jrockowitz’s picture

Status: Needs review » Fixed

I committed the patch. Please download and review the latest dev release.

isamir’s picture

Works perfectly.
Thank you Jacob for your quick reply, quick fix, and your great work in webform (one of the most complete and powerful modules in Drupal).
Also thanks for your awesome screencasts.

waiting for ajax support addition :)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.