How do I set a state to a previous one with a second click on a element

Hi bubble fam,

Right now I am able to get states working. In my workflows I have set ups like “when this element is clicked, set the state of this element to this”. The problem I am trying to solve rn is that if I want to bring an element to a default state i can’t seem to find a solution tu use the same action but just with a second click. My solution for the time being has been creating another flow that happen when clicked another element to bring the state to the default one. I also thought about creating an hidden element but there has to be a more elegant solution :slight_smile:

This is one of those hidden gems that unlock a ton of power once you master it.

There are a couple of ways to go about it.

  • Set state as a number. With ever click just add +1 to the state
  • Set “only when” conditionals in the Worfkflow action. For example: when state is blue turn red. Then create a new workflow: when state is red, turn yellow… and so on. You’ll need one workflow for each state, or one “step” for each in the same action (I’ve noticed it’s fastest the first way)

Does this make sense?

Hi @alejandrowunderlich this sounds exactly what I am looking for. I think the second part makes sense, but why the state has to be a number that I increase at each click?

1 Like

Maybe I’m misunderstanding what you’re looking to do, but if you just want to flip between a YES/NO state… you can do this

When you click (in this case) the text PointsHelp, it will flip the custom state PointsHelp, and when you click the text again, it flips the state back.

1 Like

State can be anything you want. I just used an example of a state that adds +1 with each click for a single-button, multi-state changer

You can flip through as many states as you want with a single button using the “only when” conditional:

1 Like

Maybe I am doing something wrong but in my case when I click the text a second time it doesn’t flip back

Let’s have a look. Can you post an image like the one I did?

Thank you @alejandrowunderlich that worked! Essentially I wasn’t aware I could set up a condition even before I start the actual workflow! Now everything works :slight_smile: thank you so much!

1 Like

It’s awesome!! This will unlock a ton of functionality for you! Feel free to post more questions about this if you run into any snags.

This topic was automatically closed after 70 days. New replies are no longer allowed.