# Button not sending \`topic\` as I see it

**URL:** https://discourse.nodered.org/t/button-not-sending-topic-as-i-see-it/66871
**Category:** General
**Created:** [25 August 2022 00:10 UTC](https://discourse.nodered.org/t/button-not-sending-topic-as-i-see-it/66871 "2022-08-25T00:10:41Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [25 August 2022 00:10 UTC](https://discourse.nodered.org/t/button-not-sending-topic-as-i-see-it/66871/1 "2022-08-25T00:10:41Z")

</div>

Although it is the `button` node, it is more to do with the message coming out of it.

This is the node code:

```auto
[
    {
        "id": "89af2b10f87e66e9",
        "type": "ui_button",
        "z": "f6a2d75e7dd8f7ed",
        "name": "",
        "group": "66644b9721f1197e",
        "order": 0,
        "width": 0,
        "height": 0,
        "passthru": false,
        "label": "Start",
        "tooltip": "",
        "color": "",
        "bgcolor": "",
        "className": "",
        "icon": "",
        "payload": "TRIP",
        "payloadType": "str",
        "topic": "TRAIN",
        "topicType": "msg",
        "x": 350,
        "y": 370,
        "wires": [
            [
                "0f5725cd2cbfc233",
                "a5d2da0031c49502"
            ]
        ]
    },
    {
        "id": "66644b9721f1197e",
        "type": "ui_group",
        "name": "Control",
        "tab": "530b9cb957853dd9",
        "order": 1,
        "disp": true,
        "width": "3",
        "collapse": false,
        "className": ""
    },
    {
        "id": "530b9cb957853dd9",
        "type": "ui_tab",
        "name": "Track Singal NEW",
        "icon": "dashboard",
        "order": 43,
        "disabled": false,
        "hidden": false
    }
]

```

The `topic` field is set to `TRAIN`.

But this is what I see when I press it:

 ![Screenshot from 2022-08-25 10-07-06](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/b/1b14d932f77a25985209e2fee5c06e4718b3666e.png)

Where's the `topic`?

---

<div class="post-metadata">

### Author: ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)
#### Post date: [25 August 2022 00:24 UTC](https://discourse.nodered.org/t/button-not-sending-topic-as-i-see-it/66871/2 "2022-08-25T00:24:48Z")

</div>

Change the topic to string, not msg

---

<div class="post-metadata">

### Author: ![MecatronicaMADE](https://avatars.discourse-cdn.com/v4/letter/m/ce7236/32.png) [@MecatronicaMADE](https://discourse.nodered.org/u/MecatronicaMADE)
#### Post date: [25 August 2022 00:26 UTC](https://discourse.nodered.org/t/button-not-sending-topic-as-i-see-it/66871/3 "2022-08-25T00:26:04Z")

</div>

Hi @Trying_to_learn Maybe you need to define first the msg.TRAIN property. Because you are asign msg.TRAIN to msg.topic, and msg.TRAIN is empty.

I share some examples:

 ![Screenshot from 2022-08-24 19-22-24](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/5/25a8bfa891086a66b41e6c0a7cb4272f3129d4d4.png)

Code:

```auto
[{"id":"ad061c48fbfd7f1a","type":"tab","label":"Flow 10","disabled":false,"info":"","env":[]},{"id":"7c08f886948a062c","type":"ui_button","z":"ad061c48fbfd7f1a","name":"","group":"1839522db6d21ee9","order":0,"width":0,"height":0,"passthru":true,"label":"button","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"TRIP","payloadType":"str","topic":"TRAIN","topicType":"str","x":850,"y":160,"wires":[["913cc5d5b3e72bcd"]]},{"id":"913cc5d5b3e72bcd","type":"debug","z":"ad061c48fbfd7f1a","name":"debug 14","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":980,"y":160,"wires":[]},{"id":"ec7f6b08633360bf","type":"inject","z":"ad061c48fbfd7f1a","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"str","x":730,"y":160,"wires":[["7c08f886948a062c"]]},{"id":"94a47739bd802c06","type":"ui_button","z":"ad061c48fbfd7f1a","name":"","group":"1839522db6d21ee9","order":0,"width":0,"height":0,"passthru":true,"label":"button","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"TRIP","payloadType":"str","topic":"TRAIN","topicType":"msg","x":850,"y":100,"wires":[["a6bf3b5257831bab"]]},{"id":"a6bf3b5257831bab","type":"debug","z":"ad061c48fbfd7f1a","name":"debug 15","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":980,"y":100,"wires":[]},{"id":"760c8d269517f784","type":"inject","z":"ad061c48fbfd7f1a","name":"","props":[{"p":"payload"},{"p":"TRAIN","v":"this is the topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"str","x":730,"y":100,"wires":[["94a47739bd802c06"]]},{"id":"1839522db6d21ee9","type":"ui_group","name":"Default","tab":"7394f2f3aeaeeb2d","order":1,"disp":true,"width":"6","collapse":false,"className":""},{"id":"7394f2f3aeaeeb2d","type":"ui_tab","name":"Tab 1","icon":"dashboard","disabled":false,"hidden":false}]

```

I hope it can helps you!!

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [25 August 2022 00:26 UTC](https://discourse.nodered.org/t/button-not-sending-topic-as-i-see-it/66871/4 "2022-08-25T00:26:16Z")

</div>

When did this get introduced?

It may explain why a lot of stuff has stopped working recently too. ☹😢

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [25 August 2022 00:27 UTC](https://discourse.nodered.org/t/button-not-sending-topic-as-i-see-it/66871/5 "2022-08-25T00:27:10Z")

</div>

Thanks both for the replies.

Seems I really stuffed myself up there.  
Appreciated.

---

<div class="post-metadata">

### Author: ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)
#### Post date: [25 August 2022 00:30 UTC](https://discourse.nodered.org/t/button-not-sending-topic-as-i-see-it/66871/6 "2022-08-25T00:30:08Z")

</div>

> [@Trying\_to\_learn](#):
>
> When did this get introduced?
> 
> It may explain why a lot of stuff has stopped working recently too. ☹ 😢

I don't think the default setting has been changed, but in anycase it wouldn't alter any existing buttons

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [25 August 2022 00:32 UTC](https://discourse.nodered.org/t/button-not-sending-topic-as-i-see-it/66871/7 "2022-08-25T00:32:41Z")

</div>

Well, maybe it hasn't "back rolled" to existing things, but I am writing a lot of stuff just now and it is failing _hand over fist_ as in I am pressing buttons and things NOT happening.

I was simply doing what I always did and _not seeing_ the qualifier has changed from `text` to `msg` so never even thought of seeing it.  
(Familiarity blindness - I guess)

---

<div class="post-metadata">

### Author: ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)
#### Post date: [25 August 2022 00:36 UTC](https://discourse.nodered.org/t/button-not-sending-topic-as-i-see-it/66871/8 "2022-08-25T00:36:59Z")

</div>

TBH I probably copy nodes more often than add new ones, so the text setting gets carried to the new node.

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [25 August 2022 00:39 UTC](https://discourse.nodered.org/t/button-not-sending-topic-as-i-see-it/66871/9 "2022-08-25T00:39:20Z")

</div>

I'm torn doing that only in that if the _structure_ (more so for `function` nodes than `button` nodes) it spreads bad formatting/code.

I would like to type things so I develop the _muscle memory_ on how to do things the _better_ way rather than copy/paste.  
There can be nasty things propagated that way too.

But, I do get what you are saying.

---

<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: [8 September 2022 00:40 UTC](https://discourse.nodered.org/t/button-not-sending-topic-as-i-see-it/66871/10 "2022-09-08T00:40:08Z")

</div>

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