Best way to handle multi-select / array data with "completed custom data" and tokens?

Created on 20 January 2023, almost 2 years ago
Updated 27 March 2023, over 1 year ago

Problem/Motivation

My organization uses camelCase JSON objects as a standard for all of our REST endpoints so we've been using the Completed Custom Data feature and webform_submission:values tokens to format the name value pairs with capital letters since the default keys use underscores.

However, multi-select fields are causing issues with this method. Because token data is converted to a string, we lose the array format, making it difficult for us to process on the back-end specifically when we are trying to send values including commas.

Is there a better solution to posting JSON names in camelCase, while also preserving the array format?

πŸ’¬ Support request
Status

Closed: works as designed

Version

6.1

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States cdupree

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Status changed to Postponed: needs info almost 2 years ago
  • πŸ‡ΊπŸ‡ΈUnited States jrockowitz Brooklyn, NY

    The best way to support camelCase is to allow elements keys to use camelCase via /admin/structure/webform/config/elements and change the 'Element key pattern' to support Uppercase characters.

    Does this solve your organizations use case?

  • Status changed to Active almost 2 years ago
  • πŸ‡ΊπŸ‡ΈUnited States cdupree

    Yes it does, thank you for your reply.
    I somehow assumed that all keys had to be lowercase and totally missed the examples provided with each pattern.

    CamelCase aside, is there an out-of-the-box way that Webform can post data with a custom structure (nested objects) while also still including arrays? Or, would this need to be done with some kind of custom handler?

  • Status changed to Closed: works as designed over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States jrockowitz Brooklyn, NY

    Custom data only supports tokens. You would need to write custom code.

Production build 0.71.5 2024