Trying to enable selecting a box on and off

Instead of using a checkbox to allow the user to select or unselect an element, I am trying to allow the user to click on a piece of text and its surrounding border to select it, with the ability to unselect. If you look at the site, I am trying to achieve the same functionality of enabling the user to select one or many boxes, with the ability to undo the selections. So far, I’ve created a workflow and set a custom state with a condition to change the background color and font color. It works to make the selection, but it cannot be unselected. I’ve played around and explored many approaches, but nothing has worked so far. If someone knows this, I would be grateful. Thanks.


Set up two workflows upon the same event (a click)

The first one with a condition on the event that checks if the state is what you want it to be

A second one with a condition if it is not what you want it to be.

On the first one do X

On the second do Y

Hi, thank you very much for the prompt help!
I had thought of what you have advised from a logic point of view. The thing is I couldn’t find how to enable two workflows on the same element. Even now, I’ve Googled how to do that once more and looked at the Bubble manual, but can’t find it. I’m sure it’s not rocket science :slight_smile: I’ll try again to figure it out. I appreciate the reply.

Just click ‘add an event’ in the workflow panel, then select the element action ‘when an element it clicked’ and select your button. You can run as many workflows as you like on the same button click, so as @cmarchan said above, have a different condition on each workflow, depending on whether the item is selected or not.

Thank you.

[Edit:] I’m still struggling with this.

I’m trying to have Text A with no background and font color 1 when it is not selected and with background color 1 and font color 2 when selected.

I created workflow 1 as : when Text A is clicked set state choose of app

App = the name of the page

Choose = the state name I chose

The value I entered is analytics (just an example)

Then I created the following condition for Text A:

When app’s choose is analytics the background and font parameters are as follows.

So far it works: I click on Text A and the background changes to color 1 and the font to color 2.

Of course, I cannot unselect it because I haven’t implemented the second workflow and condition. This is where I’m stuck.

In the second workflow, do I create a new state and keep the value analytics?

Do I keep the state choose and create a new value?

Or do I not change any of these and set the condition to is not instead of is?

I have tried all the above and more, and haven’t been able to figure it out yet. There seems to be something fundamental that I’m missing. I’ve watched several YouTube videos to try and resolve my dilemma, but I haven’t come across the solution yet. I have been reading the two answers on this thread so far over and over, but it’s still not clicking.

These are two good instructional videos on this subject

Thanks again. One of the videos had not come up in my previous search. I’ll watch it right now.

1 Like

I posted this question 11 days ago. Even though I promptly received a reply with instructions, I think I was too new to Bubble to be able to understand it. After a couple of days of trying various things in vain, I switched my focus to build other, easier, portions of my site. I eventually came across the video below, and low and behold, it made me understand what I had to do to resolve this issue.

1 Like

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