Button to stay a color

In my app, I have 2 buttons, when somebody clicks button 1, is like it to turn red. And when somebody clicks button 2, is like for button 1 to go back to its default color and button 2 to turn red. Does anybody know how to do this?

You can set a state for this.

For instance, create a state for your page.
State Name = On
Make it type Yes/No

When page loads, set state “On” to No
When button one is pressed, set state “On” to Yes
When button two is pressed, set state “On” to No

Set a condition for button one: When Page On is Yes, this button’s color = red; When Page On is No, this button’s color = green.

Set a condition for button two: When Page On is Yes, this button’s color = green; When Page On is No, this button’s color = red

That should do it.

1 Like

How do you make a state, im knew to all this.

Click the “i” in the element inspector of the page. It’s on the top right of the inspector.

Don’t understand what your saying up there^^ Doesn’t let me set a condition for page on

Have a workflow that runs when page is loaded. Is that what you’re asking?

I have a button that when clicked i want to change from its grey color to a red. And when button 2 is clicked, i want it to change button 1 back to its grey color and buttons to color to a red.

The instructions I posted originally will do this, just swap colors green/grey from my post.

when u say page, you mean the whole page correct?
And is it done through a workflow?

You can set a workflow to run when the page loads. It only runs when a user first arrives or refreshes the page. You can set an action inside that workflow to set a state to a value.

I recommend the tutorials big time. They will help you to get over the initial set of problems and questions you will certainly run into. Once you get the hang of these core operations, you’ll be off to the races.

I made a state for the page just like is said. Im stuck on where i need to type " when page loads, set state on to no etc."

Have you created a state for the page? That comes first. Then you can have a workflow action call that state and change its value.

Yes i have created a state.

share the app if it’s public and I’ll take a look and help!

There take a look and see if you can see what im doing wrong or make a example one

which two buttons?

10-42 and 10-41

Set the state and logic for you to play with. You should have enough to get moving in the right direction

1 Like

Thank you so much.