For select multiple components, tokens in the format "[submission:values:my-field-key]" have their values concatenated into a space-separated list.

Feature request: Create tokens in a form something like "[submission:values:my-field-key:option:my-option-key]" which would return only the information for that option. This should support ":withlabel" and the other options. Use case: A single Webform select options component filling a bunch of individual checkboxes through FillPDF. Does this make sense?

Comments

danchadwick’s picture

I think an example of [submission:values:my-field-key:option:my-option-key] might be:
[submission:values:fruit:option:apple]

If the component with the form_key "fruit" has the "apple" options selected, then the token would be "apple". If not, the value would be "".

If this is what you mean, then sure, this is a reasonable feature, and I'd be happy to test and commit your patch.

liam morland’s picture

Assigned: Unassigned » liam morland

Yes, that is what I mean. I will work on this.

danchadwick’s picture

For consistency with the (new) grid question tokens, maybe:
[submission:values:my_grid_component:my_grid_question_key]
[submission:values:my_multi_select_component:my_option_key]

In other words, drop the ":option". If there is a conflict between the my_option_key and a modifier (label, nolabel, withlabel), the option wins.

danchadwick’s picture

Still want this, Liam? If not, let's close it. Is so, maybe a patch, including for grids? :)

liam morland’s picture

I haven't had time to write this, but I still think it is a good idea.

  • DanChadwick committed e9abce7 on 7.x-4.x
    Issue #2352927 by DanChadwick: Create token for specific value of select...
danchadwick’s picture

Status: Active » Fixed
StatusFileSize
new4.17 KB

Added this option. I was surprised to see that grid question tokens were already implements.

For example:
[submission:values:select:apple:withlabel] would be a component called 'select' with an option called 'apple'. It will display "Select: apple" if the option is set in the submission, otherwise "Select:"

[submission:values:grid:favorite:apple] would be a component called 'grid' with a question 'favorite' and an option of 'apple'.

I adjusted the token help to allow for the new options.

Committed to 7.x-4.x and 8.x.

  • DanChadwick committed 68b1d39 on 8.x-4.x
    Issue #2352927 by DanChadwick: Create token for specific value of select...
danchadwick’s picture

Assigned: liam morland » Unassigned

Status: Fixed » Closed (fixed)

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