TransWikia.com

How can I render [webform_submission:values] in a table?

Drupal Answers Asked by Samay on January 31, 2021

I am trying to figure out from where [webform_submission:values] gets rendered. This is how it looks right now in the email submission.

Label 1
Value 1

Label 2
Value 2

I want this in a table format. Is there a possibility to change the render code to do this?

One Answer

You can use the Webform tokens from submitted data as following guide:

[webform_submission:values:?]

Omit the '?' to output all values. Output all values as HTML using [webform_submission:values:html]. To output individual elements, replace the '?' with…

element_key
element_key:format
element_key:raw
element_key:format:items
element_key:delta
element_key:sub_element_key
element_key:delta:sub_element_key
element_key:sub_element_key:format
element_key:delta:sub_element_key:format
element_key:delta:format
element_key:delta:format:html
element_key:entity:*
element_key:delta:entity:*
element_key:delta:entity:field_name:*
element_key:sub_element_key:entity:*
element_key:sub_element_key:entity:field_name:*
element_key:delta:sub_element_key:entity:*
element_key:checked:option_value
element_key:selected:option_value
  • All items after the 'element_key' are optional.
  • The 'delta' is the numeric index for specific value
  • The 'sub_element_key' is a composite element's sub element key.
  • The 'checked' or 'selected' looks to see if an 'option_value' is checked or selected for an options element (select, checkboxes, or radios)
  • The 'option_value' is options value for an options element (select, checkboxes, or radios).
  • The 'format' can be 'value', 'raw', or custom format specifically associated with the element
  • The 'items' can be 'comma', 'semicolon', 'and', 'ol', 'ul', or custom delimiter
  • The 'entity:*' applies to the referenced entity
  • Add 'html' at the end of the token to return HTML markup instead of plain text.

For example, to display the Contact webform's 'Subject' element's value you would use the [webform_submission:values:subject] token.

Then you can use your custom style by adding them into table or list

Answered by mr.Thi on January 31, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP