Component Parameters "other" option

Hello.

We have these parameters:

   "img_grp" : {
      "type": "group",
      "label" : "Image Options",
      "params" : {
         "overlay_color" : {
            "type"    : "choose",
            "label"   : "Color Overlay",
            "initial" : "rgba(24, 142, 206, 0.84)",
            "options" : [
                { "value" : "rgba(24, 142, 206, 0.84)", "label" : "Blue" },
                { "value" : "rgba(255, 255, 255, 0.8)", "label" : "White" },
                { "value" : "other", "label" : "Other" }
            ]
          },
         "overlay_color_custom" : {
               "type" : "color",
               "label" : "Custom Color",
               "initial" : "rgba(24, 142, 206, 0.84)",
               "when"    : "eq(overlay_color, 'other')"
          }
       }
    }

Screenshot 2023-06-07 at 3.58.12 PM

To use one of the ‘preset’ color options, we’d set {{dc:p:img_grp.overlay_color}} as the value for the color picker in the Primary tab. This is fully functional.

Screenshot 2023-06-07 at 3.58.26 PM

Our issue at hand:
How might we dynamically determine IF there is a ‘other’ option and use the value of {{dc:p:img_grp.overlay_color_custom}}?

1 Like

There’s no templating like an IF statement. Yet at least. If you change the value of other to an empty string, You can use the fallback which supports DC as a workaround for now. Then you would use this. Let me know if this helps and have a great weekend.

{{dc:p:img_grp.overlay_color fallback="dc:p:img_grp.overlay_color_custom"}}

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.