# Toggling a Label using a button

**URL:** <https://forum.inductiveautomation.com/t/toggling-a-label-using-a-button/9235>\
**Category:** General Discussion\
**Created:** [October 27, 2014, 3:20pm UTC](https://forum.inductiveautomation.com/t/toggling-a-label-using-a-button/9235 "2014-10-27T15:20:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pstojakovic](https://avatars.discourse-cdn.com/v4/letter/p/e68b1a/32.png) [@pstojakovic](https://forum.inductiveautomation.com/u/pstojakovic)\
**Post date:** [October 27, 2014, 3:20pm UTC](https://forum.inductiveautomation.com/t/toggling-a-label-using-a-button/9235/1 "2014-10-27T15:20:49Z")

</div>

So, I want to toggle a label that has a custom property called mode and is boolean. When true it should read AUTO, when false it should read MANUAL, how do I do it using a button to toggle between states - true/false? Click …AUTO…click…MANUAL…and repeats…

Thanks.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [October 27, 2014, 3:39pm UTC](https://forum.inductiveautomation.com/t/toggling-a-label-using-a-button/9235/2 "2014-10-27T15:39:06Z")

</div>

brass tacks, no fillers added… 🙂

`value = event.source.parent.getComponent('Label').mode
if value==0:
  event.source.parent.getComponent('Label').mode=1
else:
  event.source.parent.getComponent('Label').mode=0
`

---

<div class="post-metadata">

**Author:** ![pstojakovic](https://avatars.discourse-cdn.com/v4/letter/p/e68b1a/32.png) [@pstojakovic](https://forum.inductiveautomation.com/u/pstojakovic)\
**Post date:** [October 29, 2014, 2:23pm UTC](https://forum.inductiveautomation.com/t/toggling-a-label-using-a-button/9235/3 "2014-10-29T14:23:04Z")

</div>

How about toggling a boolean tag using a button. Using the system.write(tagname, value)? Can I write script on the button to send 1 and 0 to the tag continuously? So, click…sends 1…click…sends 0 and repeats…

Thanks.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [October 29, 2014, 2:43pm UTC](https://forum.inductiveautomation.com/t/toggling-a-label-using-a-button/9235/4 "2014-10-29T14:43:21Z")

</div>

You got it! ![:thumb_left:](https://us1.discourse-cdn.com/inductiveautomation/original/1X/e26afb081ddde6df016df6ee49159cf56aaca688.gif ":thumb\_left:")
