Hello!

I try to change values of webform checkbox. That module allow to configure checkbox to display: raw values (0, 1), values (Yes, No) and custom html/twig. I want to change values, especially unchecked - to  display in submission some custom info, i.e. "not chosen" or something. How can I configure it without changing module code?

Comments

wombatbuddy’s picture

1. Visit the "Advantage" tab of the Checkbox element.
2. Open the "SUBMISSION DISPLAY" section and select the "Custom..." from the "Item format" listbox.
3. Insert into the "Item format custom HTML" and "Item format custom Text" fields the code like this: 

{{ value ? 'chosen'|t : 'not chosen'|t }}

The screenshot of the example: https://www.drupal.org/files/webform_checkbox_custom_item_format-1.png

el35’s picture

Thank You!

stephen ollman’s picture

After many hours of searching I found this anwser was exactly what I needed. My checkbox was returning 1/0, but I needed true/false.

Thank you!

Certified Drupal Site Builder 7 & 8