# 2-state Toggle Buttons

**URL:** <https://forum.inductiveautomation.com/t/2-state-toggle-buttons/38309>\
**Category:** Ignition\
**Created:** [September 2, 2020, 3:36pm UTC](https://forum.inductiveautomation.com/t/2-state-toggle-buttons/38309 "2020-09-02T15:36:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![toddayers](https://avatars.discourse-cdn.com/v4/letter/t/8baadc/32.png) [@toddayers](https://forum.inductiveautomation.com/u/toddayers)\
**Post date:** [September 2, 2020, 3:36pm UTC](https://forum.inductiveautomation.com/t/2-state-toggle-buttons/38309/1 "2020-09-02T15:36:59Z")

</div>

I have 15 different 2-state toggle buttons. Each one is linked to a separate department in our plant. I also have a submit button that runs a script that logs the information from all the buttons selected(not just the department) on the form. How can I require at least one of the 2-state toggle buttons to be selected before the employee can click the submit button and log the information into our SQL table?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [September 2, 2020, 3:47pm UTC](https://forum.inductiveautomation.com/t/2-state-toggle-buttons/38309/2 "2020-09-02T15:47:39Z")

</div>

Bind the enabled state of the submit button to `{Root Container.2 State Toggle Button 1} && {Root Container.2 State Toggle Button 2}` and so on?

---

<div class="post-metadata">

**Author:** ![toddayers](https://avatars.discourse-cdn.com/v4/letter/t/8baadc/32.png) [@toddayers](https://forum.inductiveautomation.com/u/toddayers)\
**Post date:** [September 2, 2020, 3:53pm UTC](https://forum.inductiveautomation.com/t/2-state-toggle-buttons/38309/3 "2020-09-02T15:53:42Z")

</div>

So would this only require one of the 2-state buttons to be true or all of them to be true?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [September 2, 2020, 6:18pm UTC](https://forum.inductiveautomation.com/t/2-state-toggle-buttons/38309/4 "2020-09-02T18:18:12Z")

</div>

Ah, right. Use boolean OR `||` instead of AND `&&`, and it the `enabled` property will be true as long as at least one of the 2 state toggle buttons is true. Making them mutually exclusive is a little more work.

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [September 2, 2020, 8:03pm UTC](https://forum.inductiveautomation.com/t/2-state-toggle-buttons/38309/5 "2020-09-02T20:03:24Z")

</div>

You could just use addition and check for it being greater than or equal to 2 to be enabled.  
I would create a custom property on the root container called OkToSubmit of type Int and make its value something like

`{Root Container.2-State Toggle.indicatorValue}+{Root Container.2-State Toggle 1.indicatorValue}+{Root Container.2-State Toggle 2.indicatorValue}`

Then just set your submit button enabled binding to the property being greater than the custom property value.

`{Root Container.OkToSubmit}>=2`
