# Attempting to write to tags with a button press

**URL:** <https://forum.inductiveautomation.com/t/attempting-to-write-to-tags-with-a-button-press/90655>\
**Category:** Maker\
**Created:** [May 21, 2024, 7:50am UTC](https://forum.inductiveautomation.com/t/attempting-to-write-to-tags-with-a-button-press/90655 "2024-05-21T07:50:10Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Phillip\_Armstrong](https://avatars.discourse-cdn.com/v4/letter/p/eb9ed0/32.png) [@Phillip\_Armstrong](https://forum.inductiveautomation.com/u/Phillip_Armstrong)\
**Post date:** [May 21, 2024, 7:50am UTC](https://forum.inductiveautomation.com/t/attempting-to-write-to-tags-with-a-button-press/90655/1 "2024-05-21T07:50:10Z")

</div>

I would like to write to a tag representing a digital output on a modbus TCP io module. I can change the state of the output by checking the value box of the tag in the tag browser of designer, I can do it by adding a toggle switch to the view and that works great. I cannot seem to do it by using a button though. What property of the button do I bind to my tag?

A two state toggle button is not offered in the version of designer I have, I don't have any components I can use to indicate the status of inputs like an LED mimic. Is the Maker version of designer limited by comparison with the paid version?

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [May 21, 2024, 9:40am UTC](https://forum.inductiveautomation.com/t/attempting-to-write-to-tags-with-a-button-press/90655/2 "2024-05-21T09:40:15Z")

</div>

[I have never worked with Maker so let me know if some of this doesn't work.]

> I cannot seem to do it by using a button though. What property of the button do I bind to my tag?

The Toggle Switch and Checkbox components allow binding of their `selected` property to a boolean tag.  
Buttons don't have a `selected` property. You would have to right-click on the component → Configure Events ... → onActionPerformed → Script and write a script to do what you want.

> A two state toggle button is not offered in the version of designer I have.

Is the Toggle Switch component not there?

> I don't have any components I can use to indicate the status of inputs like an LED mimic.

These are easy to generate using a Label component.

![LED indicator](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/f/ff71dce61c6be6611a1da7bb9ee1954fe45c92ba.gif)

1. Create a new view. (A coordinate view will be simplest for now.)

2. Paste the Toggle Switch code below into your view.

> **Toggle Switch**
>
> ```python
> [
> {
> "type": "ia.input.toggle-switch",
> "version": 0,
> "props": {
> "label": {
> "text": "Toggle switch"
> }
> },
> "meta": {
> "name": "ToggleSwitch"
> },
> "position": {
> "x": 878,
> "y": 190.5,
> "rotate": {
> "anchor": "75% 61%"
> },
> "height": 36,
> "width": 189
> },
> "custom": {}
> }
> ]
> 
> ```

1. Paste the lblLED code block below into your view.

> **Indicator label component**
>
> ```python
> [
> {
> "type": "ia.display.label",
> "version": 0,
> "props": {
> "style": {
> "borderStyle": "solid",
> "borderWidth": 1,
> "borderColor": "#695858",
> "borderTopLeftRadius": "50%",
> "borderTopRightRadius": "50%",
> "borderBottomLeftRadius": "50%",
> "borderBottomRightRadius": "50%"
> }
> },
> "meta": {
> "name": "lblLED"
> },
> "position": {
> "x": 836.5,
> "y": 197,
> "rotate": {
> "anchor": "176% -437%"
> },
> "height": 32,
> "width": 34
> },
> "custom": {},
> "propConfig": {
> "props.style.backgroundColor": {
> "binding": {
> "type": "expr",
> "config": {
> "expression": "{../ToggleSwitch.props.selected}"
> },
> "transforms": [
> {
> "inputType": "scalar",
> "outputType": "color",
> "mappings": [
> {
> "input": true,
> "output": "#00AC00"
> }
> ],
> "fallback": "#D90000",
> "type": "map"
> }
> ]
> }
> }
> }
> }
> ]
> 
> ```

1. Turn on preview to try it out.

Have a look at how the binding is done on the label's backgroundColor. You'll be pointing that to a tag rather than the position of the Toggle Switch component.

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [May 21, 2024, 12:18pm UTC](https://forum.inductiveautomation.com/t/attempting-to-write-to-tags-with-a-button-press/90655/3 "2024-05-21T12:18:11Z")

</div>

> [@Phillip\_Armstrong](#):
>
> Is the Maker version of designer limited by comparison with the paid version?

I think the only difference is it cannot be used for commercial projects.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 21, 2024, 12:19pm UTC](https://forum.inductiveautomation.com/t/attempting-to-write-to-tags-with-a-button-press/90655/4 "2024-05-21T12:19:01Z")

</div>

It also does not have Vision and a few other modules.

---

<div class="post-metadata">

**Author:** ![Marcus\_Sysum](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/marcus_sysum/32/57944_2.png) [@Marcus\_Sysum](https://forum.inductiveautomation.com/u/Marcus_Sysum)\
**Post date:** [May 21, 2024, 3:15pm UTC](https://forum.inductiveautomation.com/t/attempting-to-write-to-tags-with-a-button-press/90655/5 "2024-05-21T15:15:57Z")

</div>

@Phillip_Armstrong  
If you would like to have a two state button bring in a multi state toggle button, and delete one of the states. I have attached a screen shot of the two state button with the props. Bind your tag to the control value and the indicator value and make sure bidirectional is checked. I have maker running connected to a plc using modbus at home to control a stack light so the kids know I am in a meeting.

 ![java_BkfBLHpsWz](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/e/fee5a0a2d53bf47b1437556b4205e81994bc91b8.png)

---

<div class="post-metadata">

**Author:** ![Phillip\_Armstrong](https://avatars.discourse-cdn.com/v4/letter/p/eb9ed0/32.png) [@Phillip\_Armstrong](https://forum.inductiveautomation.com/u/Phillip_Armstrong)\
**Post date:** [May 21, 2024, 6:12pm UTC](https://forum.inductiveautomation.com/t/attempting-to-write-to-tags-with-a-button-press/90655/6 "2024-05-21T18:12:36Z")

</div>

Thank you, I will experiment with your suggestion

---

<div class="post-metadata">

**Author:** ![Phillip\_Armstrong](https://avatars.discourse-cdn.com/v4/letter/p/eb9ed0/32.png) [@Phillip\_Armstrong](https://forum.inductiveautomation.com/u/Phillip_Armstrong)\
**Post date:** [May 21, 2024, 6:13pm UTC](https://forum.inductiveautomation.com/t/attempting-to-write-to-tags-with-a-button-press/90655/7 "2024-05-21T18:13:44Z")

</div>

There is much to learn, thanks for such a quick response
