I have a situation where I have a webform which is capturing information in the form of a questionnaire. The client would like to have the end user see their submission on the next page with another form (custom at the moment) which is simply an email field with "If you would like a copy of this report please enter your email address". The end user enters their email address and a copy of the submission is sent to them.

One idea I came up with is that you have a multi page webform. On page 1 you have all the questions and on page two you have an email field and an advanced text / markup field. The webform is set to email a copy to that email field. The submitted responses could be, or so I thought, be displayed on page two in the markup element using the token [webform_submission:values:html] but this is giving me an infinite loop error:

Maximum function nesting level of '256' reached, aborting! in Drupal\Component\Plugin\Definition\PluginDefinition->id() (line 34 of core/lib/Drupal/Component/Plugin/Definition/PluginDefinition.php).

Comments

vaccinemedia created an issue. See original summary.

jrockowitz’s picture

StatusFileSize
new3.57 KB

The attached webform replicates the issue.

jrockowitz’s picture

Status: Active » Needs review
StatusFileSize
new1.34 KB

The attached patch adds a proper exception for the recursive rendering of the [webform_submission:values] token.

jrockowitz’s picture

StatusFileSize
new3.63 KB

@vaccinemedia The attached webform uses a computed token element to safely render the submission values

  computed_token:
      '#type': webform_computed_token
      '#title': computed_token
      '#display_on': form
      '#mode': html
      '#value': '[webform_submission:values:html]'
vaccinemedia’s picture

StatusFileSize
new2.62 KB

It's not producing the crash anymore which is a step in the right direction however, the computed token output is only showing the entered value and not the actual field label AND also only showing the first webform element. I've attached an example webform for you to check out :)

jrockowitz’s picture

You must make sure to include '#display_on': form in your computed token.

Attached is a webform based on your example. The computed token is missing styles.

vaccinemedia’s picture

StatusFileSize
new38.56 KB

I've imported the yaml attached and have run a test to submit page one and attached is what I am seeing on page 2

jrockowitz’s picture

Can you switch the bartik theme? Your theme is not styling the output.

jrockowitz’s picture

I am seeing the same issue where nothing is being rendered.

jrockowitz’s picture

The new issue is that the 'Test' tab is breaking the Computed Token. Try manually entering the data.

vaccinemedia’s picture

I agree - setting test data manually works, it's the test data which does not work ;) although the form labels and their values are in the same divs with no classes. I'll check to see if this is the case when using the advanced text element.

jrockowitz’s picture

This issue is that the LABEL tag is being filtered out. This is another issue that needs to be addressed in a new ticket.

jrockowitz’s picture

I ran into an issue and just committed the LABEL fix.

Here is the patch. https://cgit.drupalcode.org/webform/patch/?id=ca960c78a4c56d0b3dc7988af6...

  • jrockowitz committed ef625c5 on 8.x-5.x
    Issue #2972242 by jrockowitz, vaccinemedia: Cannot use the [...
jrockowitz’s picture

Status: Needs review » Fixed

@vaccinemedia This issue should be fixed in the latest dev release.

You will need to apply the below patches to fix it in the release.

Status: Fixed » Closed (fixed)

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

stevendeleus’s picture

I'd like to reopen this issue because I have the exact same issue with the latest version of webform and Drupal 8.