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?
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | webform-option_tokens-2352927-6.patch | 4.17 KB | danchadwick |
Comments
Comment #1
danchadwick commentedI 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.
Comment #2
liam morlandYes, that is what I mean. I will work on this.
Comment #3
danchadwick commentedFor 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.
Comment #4
danchadwick commentedStill want this, Liam? If not, let's close it. Is so, maybe a patch, including for grids? :)
Comment #5
liam morlandI haven't had time to write this, but I still think it is a good idea.
Comment #7
danchadwick commentedAdded 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.
Comment #9
danchadwick commented