Skip to main content
Question

Using Variables to change component state

  • September 11, 2024
  • 1 reply
  • 1226 views

Fabio_Pia

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?

This topic has been closed for replies.

1 reply

Raphael_M
  • Power Member
  • September 12, 2024