# Button not getting parameters

**URL:** <https://discourse.nodered.org/t/button-not-getting-parameters/97241>\
**Category:** Dashboard\
**Created:** [23 May 2025 23:13 UTC](https://discourse.nodered.org/t/button-not-getting-parameters/97241 "2025-05-23T23:13:44Z")\
**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:** [23 May 2025 23:13 UTC](https://discourse.nodered.org/t/button-not-getting-parameters/97241/1 "2025-05-23T23:13:44Z")

</div>

(OLD Dashboard)

Sorry folks, I seem to be missing something here.

I have a button that accepts parameters but it only works if the `inject` node injects.

Brief code:

```auto
[{"id":"421170e716f91701","type":"inject","z":"c3ec93b2.f3154","g":"e00b697a44223e03","name":"set background","props":[{"p":"background","v":"black","vt":"str"},{"p":"txt","v":"Reset indicator LED","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":"1","topic":"","x":380,"y":4770,"wires":[["ceb7f828.6f2d3","14b9662bf33ecd63"]]},{"id":"ceb7f828.6f2d3","type":"ui_button","z":"c3ec93b2.f3154","g":"e00b697a44223e03","name":"Clear Flow error notification","group":"e48399e0.8415c","order":6,"width":"5","height":"1","passthru":false,"label":"{{msg.txt}}","tooltip":"","color":"yellow","bgcolor":"{{msg.background}}","className":"","icon":"","payload":"on","payloadType":"str","topic":"","topicType":"str","x":420,"y":4810,"wires":[["28b45862e13683a0","a568edf585a66d0f"]]},{"id":"90f495fc9a492b8b","type":"change","z":"c3ec93b2.f3154","g":"e00b697a44223e03","name":"","rules":[{"t":"set","p":"background","pt":"msg","to":"black","tot":"str"},{"t":"set","p":"txt","pt":"msg","to":"No errors detected","tot":"str"},{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"topic","pt":"msg","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":385,"y":4850,"wires":[["ceb7f828.6f2d3","14b9662bf33ecd63"]],"l":false},{"id":"614669d9.6a765","type":"inject","z":"c3ec93b2.f3154","g":"e00b697a44223e03","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"on","payloadType":"str","x":490,"y":4880,"wires":[["28b45862e13683a0"]]},{"id":"28b45862e13683a0","type":"junction","z":"c3ec93b2.f3154","g":"e00b697a44223e03","x":560,"y":4810,"wires":[["2671879ce407c7e9","90f495fc9a492b8b"]]},{"id":"e48399e0.8415c","type":"ui_group","name":"Flow error display","tab":"48f5e285.67a4c4","order":2,"disp":true,"width":"11","collapse":false},{"id":"48f5e285.67a4c4","type":"ui_tab","name":"ALARMS","icon":"mi-notification_important","order":6,"disabled":false,"hidden":false}]

```

The idea is that it is set (initially) to what I want.  
Something happens, it gets/receives a message and the text is changed. (txt and background actually)

Then if/when I press the button, it _RESETS_ the colour/text to _normal_.

But it isn't happening.

I've checked the messages and can't work out what it is I am doing wrong.

Thanks.

---

<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:** [23 May 2025 23:29 UTC](https://discourse.nodered.org/t/button-not-getting-parameters/97241/2 "2025-05-23T23:29:27Z")

</div>

## Slight update:

If I _modify_ the code/flow things get weird.

New flow:

```auto
[{"id":"a87c0e92c98dbede","type":"inject","z":"c3ec93b2.f3154","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":110,"y":4880,"wires":[["90f495fc9a492b8b"]]},{"id":"90f495fc9a492b8b","type":"change","z":"c3ec93b2.f3154","g":"e00b697a44223e03","name":"","rules":[{"t":"set","p":"background","pt":"msg","to":"black","tot":"str"},{"t":"set","p":"txt","pt":"msg","to":"No errors detected","tot":"str"},{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":355,"y":4880,"wires":[["ceb7f828.6f2d3","14b9662bf33ecd63"]],"l":false},{"id":"02bf8305ebddfb75","type":"inject","z":"c3ec93b2.f3154","name":"set background","props":[{"p":"background","v":"black","vt":"str"},{"p":"txt","v":"No more errors detected","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":"1","topic":"","x":120,"y":4810,"wires":[["ceb7f828.6f2d3"]]},{"id":"ceb7f828.6f2d3","type":"ui_button","z":"c3ec93b2.f3154","g":"e00b697a44223e03","name":"Clear Flow error notification","group":"e48399e0.8415c","order":6,"width":"5","height":"1","passthru":false,"label":"{{msg.txt}}","tooltip":"","color":"yellow","bgcolor":"{{msg.background}}","className":"","icon":"","payload":"on","payloadType":"str","topic":"","topicType":"str","x":420,"y":4810,"wires":[["28b45862e13683a0","a568edf585a66d0f"]]},{"id":"421170e716f91701","type":"inject","z":"c3ec93b2.f3154","g":"e00b697a44223e03","name":"set background","props":[{"p":"background","v":"black","vt":"str"},{"p":"txt","v":"Reset indicator LED","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":"1","topic":"","x":380,"y":4770,"wires":[["ceb7f828.6f2d3","14b9662bf33ecd63"]]},{"id":"614669d9.6a765","type":"inject","z":"c3ec93b2.f3154","g":"e00b697a44223e03","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"on","payloadType":"str","x":490,"y":4880,"wires":[["28b45862e13683a0"]]},{"id":"28b45862e13683a0","type":"junction","z":"c3ec93b2.f3154","g":"e00b697a44223e03","x":590,"y":4810,"wires":[["2671879ce407c7e9","90f495fc9a492b8b"]]},{"id":"e48399e0.8415c","type":"ui_group","name":"Flow error display","tab":"48f5e285.67a4c4","order":2,"disp":true,"width":"11","collapse":false},{"id":"48f5e285.67a4c4","type":"ui_tab","name":"ALARMS","icon":"mi-notification_important","order":6,"disabled":false,"hidden":false}]

```

If I press the `set background` node, things work. (That's a given)

If I press the `on` node, the `button` is _WIPED_ and nothing shown.

If I press the added `inject` node: IT WORKS!

Why?

The new `inject` node injects into the `change` node and that output is then sent to the button, and displayed correctly.

the `on` node loops back to the `change` node too.

So why is one working and one not?

This seems really above my knowledge level.

Again: Thanks in advance.

Screen shots now included:

 ![1](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/4/24a42a6be1cdeea75cdc02685265f024ed6a2b69.png)

(Above)  
This is the _RESET_ condition.  
It works. See next.

 ![2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/d/8d64e4c30acc0e1e5ed866e7d0c4086aba16c642.jpeg)

(Above)  
Text shown as sent.

 ![3](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/9/b9c4da819144c4e68c47b7b4e398f9403e627ca3.png)

(Above)  
I press the `on` node. This simulates the button being pressed.  
Follow green lines and you see the message path how it loops back to a `change` node then goes back to the button.  
Note the text.

 ![4](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/5/0506d21cb4e301f104d8b1f8f6eca64742b3663f.jpeg)

(Above)

No text.

 ![5](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/1/d1f4ec0dcc63b6383b1ce10b71eb251dfb5cc69f.png)

(Above)  
Now pressing this _NEW_ `inject` node follow green lines.  
It goes to the `change` node then into the `button` node.  
Note text.

 ![6](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/e/0e784247feb41ee8cb2f49d1b3e494d515c4ed2f.jpeg)

(Above)

Text shown.

So I am really not understanding what's going on.

N.R 4.0.9  
Dashboard 3.6.0  
Ubuntu 22.04

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [24 May 2025 00:04 UTC](https://discourse.nodered.org/t/button-not-getting-parameters/97241/3 "2025-05-24T00:04:06Z")

</div>

Looking just at your original flow

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/c/3c52c82ec6b2a2a03b444a7bea05fad30f759138.png)  
I find it hard to see what's going on, so I rearranged the flow and deleted the junction node.  
Thos is functionally the same, just easier (for me) to understand.  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/2/42feff00507946362010d4623813e6f1718db04d.png)

When the top inject node fires it sets the background colour black and the text to "Reset indicator LED"

And when the lower inject node fires _or_ the button is pressed it sets the background to black (so no change) and the text to "No errors detected".

That is exactly what I see.  
Indeed there is no other possible colour/text combination unless you have another input going directly to the button - an error alert perhaps setting background colour red and text "Tornado warning".

I can't see what the problem is here?

Sorry your expanded post is just too complex for me to grasp what's going on.

---

<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:** [24 May 2025 00:13 UTC](https://discourse.nodered.org/t/button-not-getting-parameters/97241/4 "2025-05-24T00:13:31Z")

</div>

I negated the code that actually changes what the button is showing/displaying.

That is:

```auto
[{"id":"8ab67ffd.669df","type":"function","z":"c3ec93b2.f3154","g":"e00b697a44223e03","name":"Test","func":"let colour = (msg.payload === \"on\") ? \"lime\" : \"red\";\nmsg.colour = colour\nlet colour2 = colour\nlet msg3 = {}\nmsg3.colour = null\nif (colour == \"lime\")\n{\n colour2 = \"green\"\n}\nif (msg.colour == \"red\")\n{\n msg3.background = \"red\"\n msg3.txt = \"Flow error occurred\"\n}\nnode.status({fill:colour2,shape:\"dot\",text:\"Show\"});\nreturn [msg,msg3];","outputs":2,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":580,"y":4630,"wires":[["f25ff9fd.e1d9a8","8f4c3132.3ef8e"],["ceb7f828.6f2d3"]]},{"id":"421170e716f91701","type":"inject","z":"c3ec93b2.f3154","g":"e00b697a44223e03","name":"set background","props":[{"p":"background","v":"black","vt":"str"},{"p":"txt","v":"Reset indicator LED","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":"1","topic":"","x":380,"y":4770,"wires":[["ceb7f828.6f2d3","14b9662bf33ecd63"]]},{"id":"ceb7f828.6f2d3","type":"ui_button","z":"c3ec93b2.f3154","g":"e00b697a44223e03","name":"Clear Flow error notification","group":"e48399e0.8415c","order":6,"width":"5","height":"1","passthru":false,"label":"{{msg.txt}}","tooltip":"","color":"yellow","bgcolor":"{{msg.background}}","className":"","icon":"","payload":"on","payloadType":"str","topic":"","topicType":"str","x":420,"y":4810,"wires":[["a568edf585a66d0f","28b45862e13683a0"]]},{"id":"28b45862e13683a0","type":"junction","z":"c3ec93b2.f3154","g":"e00b697a44223e03","x":590,"y":4810,"wires":[["2671879ce407c7e9","90f495fc9a492b8b"]]},{"id":"2671879ce407c7e9","type":"change","z":"c3ec93b2.f3154","g":"e00b697a44223e03","name":"set colour","rules":[{"t":"set","p":"colour","pt":"msg","to":"lime","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":645,"y":4810,"wires":[["2d46c61d39876a3a","40eb5945.ff13b8","488dc129.fc2408"]],"l":false},{"id":"614669d9.6a765","type":"inject","z":"c3ec93b2.f3154","g":"e00b697a44223e03","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"on","payloadType":"str","x":490,"y":4880,"wires":[["28b45862e13683a0"]]},{"id":"90f495fc9a492b8b","type":"change","z":"c3ec93b2.f3154","g":"e00b697a44223e03","name":"","rules":[{"t":"set","p":"background","pt":"msg","to":"black","tot":"str"},{"t":"set","p":"txt","pt":"msg","to":"No errors detected","tot":"str"},{"t":"delete","p":"payload","pt":"msg"},{"t":"delete","p":"event","pt":"msg"},{"t":"delete","p":"socketid","pt":"msg"},{"t":"set","p":"_msgid","pt":"msg","to":"cb927840a78c2b3d","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":355,"y":4880,"wires":[["ceb7f828.6f2d3","14b9662bf33ecd63"]],"l":false},{"id":"e48399e0.8415c","type":"ui_group","name":"Flow error display","tab":"48f5e285.67a4c4","order":2,"disp":true,"width":"11","collapse":false},{"id":"48f5e285.67a4c4","type":"ui_tab","name":"ALARMS","icon":"mi-notification_important","order":6,"disabled":false,"hidden":false}]

```

See orange parts.

 ![Screenshot from 2025-05-24 10-07-41](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/4/b4cc06dc7508946bf3c3a2dd7d686356d455e2bf.png)

Higher up a message arrives and goes into the `test` node (yeah, probably bad name)  
If conditions are met, it sends a message (output 2) and that changes what the button shows.

When I'm done with all things, I want to reset the button to show that all is clear.  
That is done else where in the flow. (See right with the `q-gate` node)

Anyway, trying to not digress too much....

The `test` node sends a message changing the button's text/colour.  
I _handle_ that and then press the button.  
That then _resets_ the button to saying all is good with things.

Sorry for not including that or better explaining it.

Anyway, for testing at the EDIT level, I added the `on` node just after the `button` so I could simulate it being pressed.

NEITHER work, but the other `3` inject nodes do change the `button` text/colour.  
The three are: the other `on` button - outside the group, the `set background` one outside the group and the one inside the group.  
I only added it to (maybe) better show what's going on.

---

<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:** [24 May 2025 00:25 UTC](https://discourse.nodered.org/t/button-not-getting-parameters/97241/5 "2025-05-24T00:25:36Z")

</div>

A bigger picture of how things _HAPPEN_:

All is good with the world.  
Note the big black button... RESET INDICATOR LED

 ![1](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/2/d2a76fb4bc7ad6ad3cfff6d79a527ae7a8f9f16c.jpeg)

An error happen.  
Now the button is RED and say s FLOW ERROR OCCURRED.  
(not sure about the spelling, but ....)

 ![2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/2/d28e731df25cc219486c1b003386efb091d61883.jpeg)

(Above)  
I see an indication of who and what the error is.

I click the `NEXT` button and see details  
I get the specific details for that error.

 ![3](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/1/11e8a1a26d36d20d8a55a74037b668d83791a8d9.jpeg)

I press the WIPE button to clear the display

 ![4](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/d/bd633231f8cbb543db73ee7e15b5e6572d777e85.jpeg)

And now I want to clear the indication/button.

I press the _BIG RED BUTTON_ and.....

 ![5](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/6/d6e04787d765fae9d1dd476de531417c19cf388d.jpeg)

Rather than displaying the _ALL CLEAR_ text, it is .... blank.

But, as shown with the other screen shots: Press the other `inject` buttons:  
The button accepts the new text/colour.

---

<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:** [24 May 2025 00:29 UTC](https://discourse.nodered.org/t/button-not-getting-parameters/97241/6 "2025-05-24T00:29:50Z")

</div>

Ok, not to overwhelm you.

In your example:  
the top `inject` works.

If I (either) press the button or press the lower `inject` node: the button goes blank.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [24 May 2025 00:36 UTC](https://discourse.nodered.org/t/button-not-getting-parameters/97241/7 "2025-05-24T00:36:50Z")

</div>

Hmm. It's not by any chance black text on a black background?

Mine is yellow text on a black background but I don't know where the yellow came from, CSS in some unrelated flow maybe.

---

<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:** [24 May 2025 00:45 UTC](https://discourse.nodered.org/t/button-not-getting-parameters/97241/8 "2025-05-24T00:45:10Z")

</div>

Thanks for mentioning that.

Well, as you just said: TEXT is `yellow`.

And the real (main) `inject` node sets the background as black, and the text.

(As seen here)

 ![Screenshot from 2025-05-24 10-38-45](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/9/6965d0bf77063f74ebb4f7eff890e002b8c3b477.png)

When an error happens it is set like this:

 ![Screenshot from 2025-05-24 10-41-37](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/3/133c81c986686c0744b28393ffba94cfe26cfac5.png)

If I press the button (or press any of the _faulty_ `inject` nodes the message sent to the button is:

Oh....!

Thanks.

That isn't THE problem, but I added an extra line to the `to button` `debug` node and there is a rogue message coming in there.

## THANKS!

Your reply wasn't THE solution, but it made me add an extra line between nodes and found the rogue message.

# THANKS AGAIN!

---

<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:** [24 May 2025 00:51 UTC](https://discourse.nodered.org/t/button-not-getting-parameters/97241/9 "2025-05-24T00:51:04Z")

</div>

This node was the problem.

Code modified now.

```auto
let colour = (msg.payload === "on") ? "lime" : "red"
msg.colour = colour
let colour2 = colour
let msg3 = {}
msg3.colour = null
if (colour == "lime")
{
    colour2 = "green"
}
if (msg.colour == "red")
{
    msg3.background = "red"
    msg3.txt = "Flow error occurred"
    return [msg,msg3]
}
node.status({fill:colour2,shape:"dot",text:"Show"})
return [msg,null]

```

Just to put it out there.  
It was returning `msg3` in all cases, when really it should only be if an error happened.

---

<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:** [7 June 2025 00:52 UTC](https://discourse.nodered.org/t/button-not-getting-parameters/97241/10 "2025-06-07T00:52:00Z")

</div>

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