# Button node - passthrough?

**URL:** <https://discourse.nodered.org/t/button-node-passthrough/3367>\
**Category:** Dashboard\
**Created:** [23 September 2018 09:17 UTC](https://discourse.nodered.org/t/button-node-passthrough/3367 "2018-09-23T09:17:37Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [23 September 2018 09:17 UTC](https://discourse.nodered.org/t/button-node-passthrough/3367/1 "2018-09-23T09:17:37Z")

</div>

The dashboard button config contains this -

![button](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/2/2de9b2fc6ed88c9e6d0f66fa8b5e27a943699206.png)

...which suggests if you stick an inject node in front of the button node, the msg from the inject node should pass through the button node and appear in debug.

![button2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/2/2077d1edf5fdb160d7051af81ef168faa225bcd8.png)

But it doesn't, it just sends the payload contained in the button node, and the msg from the inject node is disregarded.

My user case was to chain a number of buttons together, each of which performs a different function, and the single output then influences further processes.

![button3](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/1/1d1b97be74f97c3853eab6d0e3aa89634be5ccb9.png)

The flow for the 3 node example above;

```auto
[
    {
        "id": "d87ba0f9.de993",
        "type": "ui_button",
        "z": "6eb37a1d.ee8f34",
        "name": "button",
        "group": "ddd690d2.0351d",
        "order": 5,
        "width": "2",
        "height": "1",
        "passthru": true,
        "label": "test",
        "color": "green",
        "bgcolor": "#2A2A2A",
        "icon": "",
        "payload": "fromButton",
        "payloadType": "str",
        "topic": "",
        "x": 750,
        "y": 540,
        "wires": [
            [
                "8bdb8c06.f727f"
            ]
        ]
    },
    {
        "id": "8f4c010f.465cd",
        "type": "inject",
        "z": "6eb37a1d.ee8f34",
        "name": "inject",
        "topic": "",
        "payload": "fromInject",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 590,
        "y": 540,
        "wires": [
            [
                "d87ba0f9.de993"
            ]
        ]
    },
    {
        "id": "8bdb8c06.f727f",
        "type": "debug",
        "z": "6eb37a1d.ee8f34",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "x": 900,
        "y": 540,
        "wires": []
    },
    {
        "id": "ddd690d2.0351d",
        "type": "ui_group",
        "z": "",
        "name": "Test2",
        "tab": "117b6717.6166b9",
        "disp": true,
        "width": "27",
        "collapse": false
    },
    {
        "id": "117b6717.6166b9",
        "type": "ui_tab",
        "z": 0,
        "name": "Test2",
        "icon": "dashboard",
        "order": 7
    }
]

```

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [23 September 2018 09:54 UTC](https://discourse.nodered.org/t/button-node-passthrough/3367/2 "2018-09-23T09:54:09Z")

</div>

The button will only send a payload if the input matches the expected output - ie it acts like you pressed the button - it is not a general passthru. It will pass through all the other properties - so you can use those to tell if it was a simulated click or a real click.

Why not just wire all four buttons into the function node ?

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [23 September 2018 10:31 UTC](https://discourse.nodered.org/t/button-node-passthrough/3367/3 "2018-09-23T10:31:46Z")

</div>

It's easy to workaround, but maybe that needs clarifying in the node info.  
I read 'If msg arrives on input, pass through to output' in a different context, meaning what goes in, comes out.

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [23 September 2018 10:35 UTC](https://discourse.nodered.org/t/button-node-passthrough/3367/4 "2018-09-23T10:35:08Z")

</div>

Also, it seems to send the button node msg even if the incoming message doesn't match.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [23 September 2018 10:39 UTC](https://discourse.nodered.org/t/button-node-passthrough/3367/5 "2018-09-23T10:39:06Z")

</div>

sorry - was mixing it up with the switch node.

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [24 September 2018 20:39 UTC](https://discourse.nodered.org/t/button-node-passthrough/3367/6 "2018-09-24T20:39:59Z")

</div>

Could I have some clarity on this please;  
Is it a bug, or am I misinterpreting the node help/readme?

Paul

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [24 September 2018 20:55 UTC](https://discourse.nodered.org/t/button-node-passthrough/3367/7 "2018-09-24T20:55:56Z")

</div>

If set to pass through mode a message arriving on the input will act like pressing the button. The output payload will be as defined in the node configuration.

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [24 September 2018 21:06 UTC](https://discourse.nodered.org/t/button-node-passthrough/3367/8 "2018-09-24T21:06:52Z")

</div>

OK thanks.  
In that case I'll move to plan B!

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [24 September 2018 21:18 UTC](https://discourse.nodered.org/t/button-node-passthrough/3367/9 "2018-09-24T21:18:55Z")

</div>

@dceejay - so `If `msg` arrives on input, pass through to output:` doesn't actually pass the msg object out? If I have an inject node sending 'hello button' connected to a button that is connected to a debug, the debug will not show 'hello buton', it will show what ever is in `When clicked, send:`

Maybe the statement should read `If `msg` arrives on input, it will trigger an automatic button push`

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [24 September 2018 21:40 UTC](https://discourse.nodered.org/t/button-node-passthrough/3367/10 "2018-09-24T21:40:58Z")

</div>

Well no.. I said the **payload** is set to whatever is configured... The rest of the msg and other properties are passed through. When pressing the button you only get payload and optional topic.

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [24 September 2018 21:57 UTC](https://discourse.nodered.org/t/button-node-passthrough/3367/11 "2018-09-24T21:57:17Z")

</div>

> [@dceejay](#):
>
> Well no.. I said the **payload** is set to whatever is configured

But isn't that what Paul Z is saying?

> [@zenofmud](#):
>
> ...will trigger an automatic button push

Button push = " Clicking the button generates a message with `msg.payload` set to the **Payload** field."

Paul

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [24 September 2018 22:09 UTC](https://discourse.nodered.org/t/button-node-passthrough/3367/12 "2018-09-24T22:09:54Z")

</div>

As far as the payload goes yes. The rest of the msg may well be different.

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [24 September 2018 22:20 UTC](https://discourse.nodered.org/t/button-node-passthrough/3367/13 "2018-09-24T22:20:15Z")

</div>

...but his statement is not wrong, and probably makes more sense than what we presently have.

From a user perspective, the current wording is misleading.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [24 September 2018 22:33 UTC](https://discourse.nodered.org/t/button-node-passthrough/3367/14 "2018-09-24T22:33:11Z")

</div>

My first response to you tonight was cut/pasted from the latest (master) info panel.

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [24 September 2018 22:46 UTC](https://discourse.nodered.org/t/button-node-passthrough/3367/15 "2018-09-24T22:46:35Z")

</div>

I did check first, but I'm not seeing that - [https://github.com/node-red/node-red-dashboard/blob/master/nodes/ui\_button.html](https://github.com/node-red/node-red-dashboard/blob/master/nodes/ui_button.html)

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [24 September 2018 23:58 UTC](https://discourse.nodered.org/t/button-node-passthrough/3367/16 "2018-09-24T23:58:56Z")

</div>

To sumarize:

If passthru is NOT checked, any flow msg entering the ui\_node will go no further - it's a dead end. The only time a msg will leave the node is when the button is pushed on the dashboard.

If pastthru IS checked and a msg enters the ui\_node, all parts of the msg except `payload` and `topic` will remain unchanged. For `payload` and `topic` the following applies:

- payload - will becone the value set in the ui\_button or if it is left blank, it becomes the id of the ui-button (for example: `payload: "4b7e1b33.5b482c"`)
- topic - will become the value set in the ui\_button node or if left blank, the existing msg.topic will not change.

---

<div class="post-metadata">

**Author:** ![IanH](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ianh/32/95002_2.png) [@IanH](https://discourse.nodered.org/u/IanH)\
**Post date:** [20 October 2019 06:33 UTC](https://discourse.nodered.org/t/button-node-passthrough/3367/17 "2019-10-20T06:33:55Z")

</div>

I am also trying to get this node to pass through a variable `msg.Zone` which has been set through a previous dropdown list ui. Nothing passes through the ui\_button node and I need `msg.Zone` for the next nodes (selects an element of an Context file array for changing.)  
Running Node-red 1.0.2 on windows

`[{"id":"b46402af.18cde","type":"tab","label":"UI_button bug?","disabled":false,"info":""},{"id":"6e4d938e.bc05ec","type":"ui_dropdown","z":"b46402af.18cde","name":"","label":"Zone","tooltip":"","place":"Select Zone to edit","group":"3b78ccda.b81e54","order":0,"width":0,"height":0,"passthru":true,"options":[{"label":"","value":"","type":"str"}],"payload":"","topic":"","x":113,"y":923,"wires":[["be3ee684.df72e8","cc2d059.f8f7bf8"]]},{"id":"dfd57b59.68a4f8","type":"ui_button","z":"b46402af.18cde","name":"","group":"3b78ccda.b81e54","order":0,"width":0,"height":0,"passthru":false,"label":"LoadCurrent Zone Values","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":503,"y":923,"wires":[["ea1fa810.5e4448"]]},{"id":"f454008b.a50d4","type":"change","z":"b46402af.18cde","name":"","rules":[{"t":"set","p":"Zone","pt":"msg","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":167,"y":842,"wires":[["166fe87c.c69cb8"]]},{"id":"166fe87c.c69cb8","type":"change","z":"b46402af.18cde","name":"","rules":[{"t":"set","p":"options","pt":"msg","to":"[{\"Spare\":0},{\"Bed 1\":1},{\"Bed 2\":2},{\"Bed 3\":3},{\"Bed 4\":4},{\"Bed 5\":5},{\"East Bed\":6},{\"West Bed\":7}]","tot":"json"},{"t":"set","p":"payload","pt":"msg","to":"Zone","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":355,"y":841,"wires":[["6e4d938e.bc05ec","f0ea1ec4.bc0e8"]]},{"id":"ea1fa810.5e4448","type":"debug","z":"b46402af.18cde","name":"4 Common","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":702,"y":1018,"wires":[]},{"id":"be3ee684.df72e8","type":"change","z":"b46402af.18cde","name":"","rules":[{"t":"set","p":"Zone","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":280,"y":923,"wires":[["dfd57b59.68a4f8","9e7efb95.20bf78"]]},{"id":"9e7efb95.20bf78","type":"debug","z":"b46402af.18cde","name":"3 Common","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":441,"y":1012,"wires":[]},{"id":"cc2d059.f8f7bf8","type":"debug","z":"b46402af.18cde","name":"2 Common","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":229,"y":1007,"wires":[]},{"id":"f0ea1ec4.bc0e8","type":"debug","z":"b46402af.18cde","name":"1 Common","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":635,"y":832,"wires":[]},{"id":"eb7f10fd.8d82b","type":"inject","z":"b46402af.18cde","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":93.5,"y":760,"wires":[["f454008b.a50d4"]]},{"id":"3b78ccda.b81e54","type":"ui_group","z":"","name":"Default","tab":"58a3d04c.c5bb7","disp":true,"width":"6","collapse":false},{"id":"58a3d04c.c5bb7","type":"ui_tab","z":"","name":"ButtonBug","icon":"dashboard","disabled":false,"hidden":false}]`

---

<div class="post-metadata">

**Author:** ![IanH](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ianh/32/95002_2.png) [@IanH](https://discourse.nodered.org/u/IanH)\
**Post date:** [20 October 2019 06:56 UTC](https://discourse.nodered.org/t/button-node-passthrough/3367/18 "2019-10-20T06:56:03Z")

</div>

I have a workaround, that is to save msg.Zone into flow.Zone before button, the set the payload to flow.Zone. But I thought the idea of Node red was this stuff should be passed through the messages, saving temporary data to context may give issues later.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [20 October 2019 07:05 UTC](https://discourse.nodered.org/t/button-node-passthrough/3367/19 "2019-10-20T07:05:13Z")

</div>

I am not able to test your flow at the moment, but have you made sure the payload is set to either the on or off values defined for the switch? You can check that by making sure that your message sets the switch state when you send it, having first set the switch to the other state obviously.

**[edit]** Sorry, I misread your post, I thought you were talking about a ui-switch node rather than a button node. I notice that you have not selected Emulate a button click if message arrives on input. Have you tried selecting that?

---

<div class="post-metadata">

**Author:** ![IanH](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ianh/32/95002_2.png) [@IanH](https://discourse.nodered.org/u/IanH)\
**Post date:** [24 October 2019 06:23 UTC](https://discourse.nodered.org/t/button-node-passthrough/3367/20 "2019-10-24T06:23:15Z")

</div>

Thanks, I thought you might have been on the wrong node, thanks for the correction.

I do not want the 'button click' on message arrives function as that will prematurely set off next message.

[Next page](https://discourse.nodered.org/t/button-node-passthrough/3367.md?page=2)
