Using Variables to change component state

I’m trying to set up a button so that it changes from a disabled to an active state when a certain condition is met. The condition is that at least two components (cards) need to be selected.

Currently, I’ve created two string variables: merge-button-state (with a default value of inactive) and card-state (with a default value of default). On each card, I’ve set an “on click” action to set card-state to “selected”, followed by the condition:

if card-state == "selected" 
  set merge-button-state to "active"

This works if I select just one card, but I want the button to become active only when at least two cards are selected.

I’ve also tried creating a variable for each card component, like card1-state and card2-state, but since it’s the same component, this approach doesn’t work.

Any idea how to achieve that?

Try this one How to add selection counter, and activate the 'Next' button when 5 options are selected? - #2 by Raphael_M

1 Like