# One button two states?

**URL:** <https://forum.bubble.io/t/one-button-two-states/49249>\
**Category:** Need help\
**Created:** [February 11, 2019, 4:51pm UTC](https://forum.bubble.io/t/one-button-two-states/49249 "2019-02-11T16:51:20Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ben4](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/ben4/32/20434_2.png) [@ben4](https://forum.bubble.io/u/ben4)\
**Post date:** [February 11, 2019, 4:51pm UTC](https://forum.bubble.io/t/one-button-two-states/49249/1 "2019-02-11T16:51:20Z")

</div>

What i am trying to do is create on and off buttons. Meaning a button is click the state is set to ‘yes’ but if it is clicked again it will set the state to ‘no’.

I cant seem to figure this out. When i create two workflow steps they basically cancel each other out. I cant see to do and IF on the steps.

If set to no, run this step. If set to yes, run this step.

Can anyone help me with this???

The alternative is the check box element, but it doesnt look nearly as good.

I appreciate any help. Thank You.

---

<div class="post-metadata">

**Author:** ![Kfawcett](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/kfawcett/32/38097_2.png) [@Kfawcett](https://forum.bubble.io/u/Kfawcett)\
**Post date:** [February 11, 2019, 4:58pm UTC](https://forum.bubble.io/t/one-button-two-states/49249/2 "2019-02-11T16:58:20Z")

</div>

Create two on click workflows for the button, where each has an “only when” condition. So it reads like:

1st workflow = “when button X is clicked and state name = “yes””

- action in workflow would be to set button state to “no”

2nd workflow = “when button X is clicked and state name = “no””

- action in workflow would be to set button state to “yes”

---

<div class="post-metadata">

**Author:** ![jarrad](https://avatars.discourse-cdn.com/v4/letter/j/ecae2f/32.png) [@jarrad](https://forum.bubble.io/u/jarrad)\
**Post date:** [February 11, 2019, 5:32pm UTC](https://forum.bubble.io/t/one-button-two-states/49249/3 "2019-02-11T17:32:33Z")

</div>

> [@Build ON/OFF Switches, Swipe to do Action, Choice Sliders Demo](http://forum.bubble.io/t/build-on-off-switches-swipe-to-do-action-choice-sliders-demo/18056/8):
>
> You could use the choice style you see in the demo, setup a bubble button for back & one for forward with 0px width & height, give the buttons an id - then when the choice is made use the, $('#myBackButtonsID').click(); Then just make the bubble buttons have the respective actions inside the workflow for show next & prev.

---

<div class="post-metadata">

**Author:** ![ben4](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/ben4/32/20434_2.png) [@ben4](https://forum.bubble.io/u/ben4)\
**Post date:** [February 11, 2019, 5:34pm UTC](https://forum.bubble.io/t/one-button-two-states/49249/4 "2019-02-11T17:34:16Z")

</div>

Hey Thank you so much. I never thought this through enough and came up with the idea of having two different workflows. I kept putting the steps in the same click action. Wow… Genius. Haha. Thank you!

---

<div class="post-metadata">

**Author:** ![Kfawcett](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/kfawcett/32/38097_2.png) [@Kfawcett](https://forum.bubble.io/u/Kfawcett)\
**Post date:** [February 11, 2019, 6:10pm UTC](https://forum.bubble.io/t/one-button-two-states/49249/5 "2019-02-11T18:10:36Z")

</div>

Great @ben4! Would you please select the post that fixed your issue and click the Solution checkbox.

![image](https://us1.discourse-cdn.com/bubble/original/3X/9/a/9a1613141c4c80b4804d0973effe8afe7555aa1e.png)

---

<div class="post-metadata">

**Author:** ![keith](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/keith/32/56020_2.png) [@keith](https://forum.bubble.io/u/keith)\
**Post date:** [February 11, 2019, 6:31pm UTC](https://forum.bubble.io/t/one-button-two-states/49249/6 "2019-02-11T18:31:09Z")

</div>

This will work, but it’s not the best way. See the “Cool with Boole” video for how to best invert Boolean states.

> [@Video: Working with Booleans (yes/no values) in Bubble - Are YOU Cool with Boole?](http://forum.bubble.io/t/video-working-with-booleans-yes-no-values-in-bubble-are-you-cool-with-boole/37899):
>
> I see a lot of confusion related to our good friend (and one of the most simple, but powerful datatypes) the “yes/no” data type. I made this video that covers many topics including the various UI elements for interacting with Booleans – including how to make custom checkboxes (it’s easier than you think) – and the Bubble way to negate (invert) a Boolean. Find it here: [[Booleans in Bubble - Yes/No Data Type - Are You Cool with Boole?] ](https://vimeo.com/289546292) The thread that inspired me to do this is here…

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/bubble/original/3X/2/8/2847faa74692c2ffa5d939d3dc3724cdd060d247.png) [@system](https://forum.bubble.io/u/system)\
**Post date:** [April 22, 2019, 4:51pm UTC](https://forum.bubble.io/t/one-button-two-states/49249/7 "2019-04-22T16:51:23Z")

</div>

Closed on April 22, 2019, 4:51pm UTC

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