Token no longer displays field label

Created on 2 February 2024, 10 months ago
Updated 3 February 2024, 10 months ago

Problem/Motivation

I raised an issue on CiviCRM Stack Webform 6.2 Tokens not displaying label as I thought there may be an integration issue between CiviCRM fields and plain Drupal fields, but a simple test shows otherwise.

Tokens that I had previously used in Drupal 7 and Webform 7 were no longer functioning as before and failing to display a field label when using the syntax described in the new documentation i.e:

[webform_submission:values:element_key] - this should give you the field label plus the value
[webform_submission:values:element_key:raw] - this should give you only the value

Steps to reproduce

  1. Create a simple webform with two fields, a text field and an email field
  2. Create a confirmation page that displays [webform_submission:values:element_key] and [webform_submission:values:element_key:raw]
  3. Add a handler to send an email with the same data 2.
  4. Test the form

Both the confirmation screen and email show identical data i.e. the field label is not outputted. Using [webform_submission:values] correctly outputs both labels and data but for all values submitted and is therefore unsuited to customised output.

A work around is possible to manually input the labels and use the :raw parameter, but this negates the useful feature that blank data in fields is automatically not output, and so there are no orphan labels output when no data is available. This makes things like address output look good - no missing lines in multline addresses etc.

I think this may be a regression after looking at this closed issue:

Webform submission token values nolabel not working β†’

This person had the opposite problem to me.

πŸ› Bug report
Status

Closed: won't fix

Version

6.2

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom chumkui

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

Comments & Activities

  • Issue created by @chumkui
  • Status changed to Closed: won't fix 10 months ago
  • πŸ‡ΊπŸ‡ΈUnited States jrockowitz Brooklyn, NY

    Tokens that I had previously used in Drupal 7 and Webform 7 were no longer functioning as before and failing to display a field label when using the syntax described in the new documentation i.e:

    Webform 5.x+ is not 1-to-1 port of the Webform 4.x branch.

    I am sorry that the token behavior has changed, but at this point, with stable releases, we can change how tokens work in the 5.x+ branch.

    In custom code or dedicated control module, you can create webform submission tokens that include the element's label.

  • πŸ‡¬πŸ‡§United Kingdom chumkui

    Thanks Jacob - no problem, I'll work around. Thanks for all your work on a truly awesome module!

Production build 0.71.5 2024