Forum Academy Marketplace Showcase Pricing Features

Replace an image when pressed?


I have a set of 6 icons (images) that when pressed would like to replace them with the same icon that has a different colour, so as to represent that it has been selected/pressed. I would like it to be able to toggle between being selected AND un-selected (eg; on and off)…

I have been able to replace the image by setting a Custom State…but I haven;t been able to figure out how to toggle it off again.

I suppose a way that could work is if I set the state based on what the current state value is now,

eg; if current custom state value is “Unselected” then new value = “Selected” and vice versa.

please help?

You have the answer yourself I think.

Two actions with conditions … “if current custom state value is “Unselected” then new value = “Selected” and vice versa”.

It really is fun when you get to solve the problem you’ve been struggling with in Bubble just simply by writing the problem in plain English. It doesn’t always work out, but more often than not.

1 Like

I know what I want to achieve, but I guess the question is HOW…it doesn’t appear that you can put an IF this THAN that statement in the value field of a custom state?!

You put the “IF” on the action in the workflow. So you need two workflows.

One says and when “custom state is Selected”.

The other says and when “custom state is UnSelected”.

1 Like

excellent!- thats worked :slightly_smiling:

1 Like