# forwardInputMessages in UI node

**URL:** https://discourse.nodered.org/t/forwardinputmessages-in-ui-node/41513
**Category:** Developing Nodes
**Created:** [23 February 2021 21:00 UTC](https://discourse.nodered.org/t/forwardinputmessages-in-ui-node/41513 "2021-02-23T21:00:49Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)
#### Post date: [23 February 2021 21:00 UTC](https://discourse.nodered.org/t/forwardinputmessages-in-ui-node/41513/1 "2021-02-23T21:00:49Z")

</div>

Hi folks,

I'm wondering how `forwardInputMessages` in a UI node works.

The dashboard Switch-node has following setting:

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/e/aeef6f0e00bddc77f2e732b2580fb2f50d4fd313.png)

By looking at the Switch-node ([code](https://github.com/node-red/node-red-dashboard/blob/master/nodes/ui_switch.js#L73)), it is being used like this:

```auto
forwardInputMessages: config.passthru,

```

But when I use it like that in the node-red-contrib-ui-multistate-switch node, then it works like this:

1. If `true` then _ **all** _ messages will be passed through
2. if `false` then _ **no** _ messages will be passed through

However for case 1 I had expected the passthrough only to happen when the payload triggers a _ **new** _ state? But now the msg is also passed through when the switch doesn't change state...

I don't see anything extra that I should do to make it behave like that...

Thanks!!  
Bart

---

<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: [23 February 2021 21:18 UTC](https://discourse.nodered.org/t/forwardinputmessages-in-ui-node/41513/2 "2021-02-23T21:18:55Z")

</div>

The config text and the help text for the ui\_switch are misleading. It either passes through or it doesn't. Simple as that. In addition, If the payload matches one of the switch states, then it sets the switch, if not it doesn't set the switch.

---

<div class="post-metadata">

### Author: ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)
#### Post date: [23 February 2021 21:54 UTC](https://discourse.nodered.org/t/forwardinputmessages-in-ui-node/41513/3 "2021-02-23T21:54:56Z")

</div>

Hey Colin,  
Thanks a lot for your explanation!

---

<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: [23 February 2021 21:58 UTC](https://discourse.nodered.org/t/forwardinputmessages-in-ui-node/41513/4 "2021-02-23T21:58:16Z")

</div>

In fact they are plain wrong really. I keep meaning to do a PR to improve them but haven't got round to it.

---

<div class="post-metadata">

### Author: ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)
#### Post date: [23 February 2021 22:00 UTC](https://discourse.nodered.org/t/forwardinputmessages-in-ui-node/41513/5 "2021-02-23T22:00:30Z")

</div>

Do you mean that you want that the input msg should only be forwarded when the state changes, like the checkbox label describes?

---

<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: [23 February 2021 22:02 UTC](https://discourse.nodered.org/t/forwardinputmessages-in-ui-node/41513/6 "2021-02-23T22:02:10Z")

</div>

No, sorry, I should have been clearer. The operation is perfect, it is the the dialog and help text that need sorting.

---

<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 February 2021 22:02 UTC](https://discourse.nodered.org/t/forwardinputmessages-in-ui-node/41513/7 "2021-02-23T22:02:56Z")

</div>

Link to previous discussion - [Switch node - what is point of Show State of Output option?](https://discourse.nodered.org/t/switch-node-what-is-point-of-show-state-of-output-option/41225)

---

<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: [23 February 2021 22:21 UTC](https://discourse.nodered.org/t/forwardinputmessages-in-ui-node/41513/8 "2021-02-23T22:21:30Z")

</div>

Ah yes, what I said is not quite true. When in non-pass through mode, if the node is set to Show State of Output then the incoming message does _not_ set the state of the switch, but may affect other attributes of the switch.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [9 March 2021 22:22 UTC](https://discourse.nodered.org/t/forwardinputmessages-in-ui-node/41513/9 "2021-03-09T22:22:11Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
