Allow HTML lists in submission value tokens

Created on 1 May 2024, about 2 months ago

Problem/Motivation

Attempting to use the [webform_submission:values:FIELD:format:ul] token on the confirmation page results in values separated by hyphens, not in a HTML unordered list.

Steps to reproduce

  1. Install Webform 6.2.x on Drupal 10.3.x
  2. Build a webform with the YAML below
  3. Set the Confirmation message to [webform_submission:values:interests:format:ul]
  4. Submit the webform, observe confirmation message (see below)

YAML

interests:
  '#title': Interest
  '#type': checkboxes
  '#required': true
  '#options':
    cricket: Cricket
    football: Football
    golf: Golf
  '#options__properties':
    golf:
      '#disabled': true

Expected confirmation message:

<div class="webform-confirmation__message">
<ul>
  <li>Cricket</li>
  <li>Football</li>
</ul>
</div>

Actual confirmation message:

<div class="webform-confirmation__message">
<p>- Cricket
- Football
</p>
</div>

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ’¬ Support request
Status

Closed: works as designed

Version

6.2

Component

Code

Created by

πŸ‡¦πŸ‡ΊAustralia mstrelan

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @mstrelan
  • πŸ‡¦πŸ‡ΊAustralia mstrelan

    I looked at the code, this is by design. Changing to feature request.

  • Status changed to Closed: works as designed about 2 months ago
  • πŸ‡¦πŸ‡ΊAustralia mstrelan

    Sorry, I missed this part.

    Add 'html' at the end of the token to return HTML markup instead of plain text.

    That said, it might be worth adding an example to \Drupal\Tests\webform\Functional\Token\WebformTokenSubmissionValueTest::testWebformTokenSubmissionValue.

    For anyone else who comes across this, the correct token is [webform_submission:values:interests:format:ul:html].

Production build 0.69.0 2024