Dashboard - How to add OK or Cancel button

OK or Cancel button.

Looking for a method to the following Button action.

When use press the Button. The user will be propmted to select a OK or Cancel button
IF OK =true then send msg.payload
IF Cancel . Then do nothing.

I tried the 'show dialog' widget and selected OK/Cancel dialog. But that does not seem set a msg.payload to make a decision .

Surely this has come up before.
Thank you in advance.

you need something to prompt it ... eg

[{"id":"431f19b3.86d4e8","type":"ui_button","z":"d511095d.512808","name":"","group":"ef85e3b9.8fa4b","order":0,"width":0,"height":0,"passthru":false,"label":"Press","color":"","bgcolor":"","icon":"","payload":"Do you want to continue","payloadType":"str","topic":"","x":140,"y":900,"wires":[["90fa4e9c.a86ab"]]},{"id":"90fa4e9c.a86ab","type":"ui_toast","z":"d511095d.512808","position":"dialog","displayTime":"3","highlight":"","outputs":1,"ok":"OK","cancel":"Cancel","topic":"choice","name":"","x":330,"y":900,"wires":[["be3bc9fa.2aa788"]]},{"id":"be3bc9fa.2aa788","type":"debug","z":"d511095d.512808","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","hideButton":false,"x":530,"y":900,"wires":[]},{"id":"ef85e3b9.8fa4b","type":"ui_group","z":"","name":"Default","tab":"5fcfdb19.86a2b4","disp":true,"width":"6","collapse":false},{"id":"5fcfdb19.86a2b4","type":"ui_tab","z":"","name":"Home","icon":"dashboard"}]

Thank you dceejay!

Ok, I see that:
The value in the "Default Action Label "
and "Secondary Action Label" passed out as the msg.payload

so just triggered off of that.

Thanks again!

if i have one text input on dashboard and i want send "yes or not" with show dialog

but i want msg.payload in output no yes or not…….undestend?

Not fully. Do you just mean the display is what you want but you want to change the payload values in the output message to something else? If so then you can use a Change node on the output.

where'is my error? :frowning:
[{"id":"df1dc23c.d66fd","type":"ui_button","z":"1dd545bc.459dca","name":"","group":"eb8dd523.be4718","order":0,"width":0,"height":0,"passthru":false,"label":"Press","color":"","bgcolor":"","icon":"","payload":"Do you want to continue","payloadType":"str","topic":"","x":190.00000381469727,"y":249.0000343322754,"wires":[["b703480f.5f8fe8"]]},{"id":"b703480f.5f8fe8","type":"ui_toast","z":"1dd545bc.459dca","position":"dialog","displayTime":"3","highlight":"","outputs":1,"ok":"OK","cancel":"Cancel","topic":"choice","name":"","x":383.00000762939453,"y":251.00004768371582,"wires":[["a85bc966.a567d8"]]},{"id":"9c2a3d29.94597","type":"ui_text_input","z":"1dd545bc.459dca","name":"","label":"","group":"eb8dd523.be4718","order":0,"width":0,"height":0,"passthru":false,"mode":"text","delay":300,"topic":"note","x":191.50003814697266,"y":343.6666965484619,"wires":[["b97ced02.57dc5"]]},{"id":"b97ced02.57dc5","type":"change","z":"1dd545bc.459dca","name":"","rules":[{"t":"move","p":"payload","pt":"msg","to":"payload.on","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":388.5,"y":342.66668701171875,"wires":[["a85bc966.a567d8"]]},{"id":"a85bc966.a567d8","type":"change","z":"1dd545bc.459dca","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"OK","fromt":"str","to":"payload.on","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":675.5,"y":298.3333435058594,"wires":[[]]},{"id":"eb8dd523.be4718","type":"ui_group","z":"","name":"Default","tab":"281b30b0.aa591","disp":true,"width":"6","collapse":false},{"id":"281b30b0.aa591","type":"ui_tab","z":"","name":"Home","icon":"dashboard","order":4}]

First remember that the messages arriving down the two paths will arrive at different times. When the second message arrives the first one is long gone and the Change node does not remember what was in the previous message. You can use a Join node set to key/value pairs mode to combine the information in the two messages if that is what you are trying to do, then you may be able to use a Change node to do what you want, though it is not clear to me exactly what you want to achieve. Start off by experimenting with the Join node to combine the messages down the two paths.

Something I am confused about is when is it that you want the ok/cancel dialog to popup?

i want write one note and push button to send and another for ok or no
this message i want sent in one mssql

OK, I understand. In that case, yes you should use a join node to merge them together into key/value pairs. You don't need to move the payload in the lower branch to a different property, just make sure the two paths have different topics.
Possibly then easiest to use a Function node to do the rest.

sorry i can try.........who can help me?
i want send one message in one text when i push button

[{"id":"8b09814e.bdae2","type":"tab","label":"DATABASE","disabled":false,"info":""},{"id":"644d9d47.d06f24","type":"ui_text_input","z":"8b09814e.bdae2","name":"","label":"","group":"930342e5.d01e","order":0,"width":0,"height":0,"passthru":true,"mode":"text","delay":300,"topic":"","x":397.01952362060547,"y":339.0039281845093,"wires":[["483eeac2.f30734"]]},{"id":"eae0c2a9.948bc","type":"ui_text_input","z":"8b09814e.bdae2","name":"","label":"","group":"930342e5.d01e","order":0,"width":0,"height":0,"passthru":true,"mode":"text","delay":300,"topic":"","x":392.01953887939453,"y":405.00392055511475,"wires":[["346dba21.ede096"]]},{"id":"6a66c1b8.865ff","type":"ui_text_input","z":"8b09814e.bdae2","name":"","label":"","group":"930342e5.d01e","order":0,"width":0,"height":0,"passthru":true,"mode":"text","delay":300,"topic":"","x":396.0195426940918,"y":471.0039806365967,"wires":[["ade47b7a.a526b8"]]},{"id":"483eeac2.f30734","type":"ui_button","z":"8b09814e.bdae2","name":"","group":"9ad5468c.2ec478","order":0,"width":0,"height":0,"passthru":false,"label":"button","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":598.0195198059082,"y":343.0039577484131,"wires":[["afafcb0f.6fca08"]]},{"id":"346dba21.ede096","type":"ui_button","z":"8b09814e.bdae2","name":"","group":"9ad5468c.2ec478","order":0,"width":0,"height":0,"passthru":false,"label":"button","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":601.019552230835,"y":406.00394344329834,"wires":[["afafcb0f.6fca08"]]},{"id":"ade47b7a.a526b8","type":"ui_button","z":"8b09814e.bdae2","name":"","group":"9ad5468c.2ec478","order":0,"width":0,"height":0,"passthru":false,"label":"button","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":599.0195426940918,"y":470.003981590271,"wires":[["afafcb0f.6fca08"]]},{"id":"fc0face1.8fded","type":"ui_button","z":"8b09814e.bdae2","name":"clear-button","group":"930342e5.d01e","order":0,"width":0,"height":0,"passthru":false,"label":"Clear","color":"","bgcolor":"","icon":"","payload":"[]","payloadType":"json","topic":"","x":166.02349090576172,"y":387.03910636901855,"wires":[["644d9d47.d06f24","eae0c2a9.948bc","6a66c1b8.865ff"]]},{"id":"afafcb0f.6fca08","type":"ui_text","z":"8b09814e.bdae2","order":0,"width":0,"height":0,"name":"","label":"text","format":"{{msg.payload}}","layout":"row-spread","x":834.14453125,"y":396.546875,"wires":[]},{"id":"930342e5.d01e","type":"ui_group","z":"","name":"Database","tab":"d3375d9d.b1893","disp":true,"width":"6","collapse":false},{"id":"9ad5468c.2ec478","type":"ui_group","z":"","name":"swich","tab":"d3375d9d.b1893","disp":true,"width":"6","collapse":false},{"id":"d3375d9d.b1893","type":"ui_tab","z":"","name":"prova","icon":"dashboard","order":1}]

@marioarmillei please read this post How to share code or flow json and edit your previous posts to properly format your flows

Which button? you have four, three that say 'BUTTON' and one that says 'CLEAR'

Why don't you simplify? Remove all but one set and add debugs to the output of each node. Than way you can see what is happening as the flow executes.

Hi @marioarmillei - once again, I'm asking you to read this post How to share code or flow json about how to properly share flows in this forum.

Mario,
you need to read the descriotion of each node you are using and experiment with them.
Put a debug node on the output of each of your nodes and examine what they contain. Select one of your list items then go look at the debug. What do you fine?

What do you see coming out of the button node?
What does the node description tell you it will be?

ok now i have semplificate.
i have one dropdown
select name and i want send name when push button.

[{"id":"7c4726bc.81cab8","type":"tab","label":"DATABASE","disabled":false,"info":""},{"id":"c9f0e2b2.6112","type":"ui_text","z":"7c4726bc.81cab8","group":"9ad5468c.2ec478","order":3,"width":0,"height":0,"name":"","label":"text","format":"{{msg.op}}","layout":"row-spread","x":710.0196495056152,"y":361.0039119720459,"wires":[]},{"id":"35c0045c.abb6bc","type":"ui_button","z":"7c4726bc.81cab8","name":"","group":"9ad5468c.2ec478","order":2,"width":0,"height":0,"passthru":false,"label":"start message","color":"","bgcolor":"","icon":"","payload":"true","payloadType":"bool","topic":"","x":117.01958084106445,"y":266.0039310455322,"wires":[["bfa408e9.9eb048"]]},{"id":"c3f5c4a6.3ea488","type":"ui_dropdown","z":"7c4726bc.81cab8","name":"","label":"","place":"Select option","group":"9ad5468c.2ec478","order":1,"width":0,"height":0,"passthru":true,"options":[{"label":"","value":"franco","type":"str"},{"label":"","value":"adriano","type":"str"},{"label":"","value":"mario","type":"str"}],"payload":"","topic":"op","x":134.14845275878906,"y":366.7148857116699,"wires":[["bfa408e9.9eb048"]]},{"id":"bfa408e9.9eb048","type":"function","z":"7c4726bc.81cab8","name":"","func":"if (msg.payload =='TRUE') {\n  \nHELP ME\n\nreturn msg;","outputs":1,"noerr":5,"x":482.18055725097656,"y":361.01737213134766,"wires":[["c9f0e2b2.6112"]]},{"id":"d5136865.de2d38","type":"ui_button","z":"7c4726bc.81cab8","name":"","group":"9ad5468c.2ec478","order":0,"width":0,"height":0,"passthru":false,"label":"clear","color":"","bgcolor":"","icon":"","payload":"[]","payloadType":"str","topic":"","x":569.1944236755371,"y":459.9930992126465,"wires":[["c9f0e2b2.6112"]]},{"id":"9ad5468c.2ec478","type":"ui_group","z":"","name":"swich","tab":"d3375d9d.b1893","disp":true,"width":"6","collapse":false},{"id":"d3375d9d.b1893","type":"ui_tab","z":"","name":"prova","icon":"dashboard","order":1}]

Mario, I'm trying to teach you how to do this. So lets take this one node at a time.Please answer my questions so I know you are trying to learn.

  1. if you attach a debug node to a button node and press the button, what shows in the debug?
  2. how does that agree/disagree what the info tab for the button node tells you?

thanks for helm me... Paul
I'm learning..node-red
in the function write
if msg = true send message of dropdown
then send null
is correct?

message of dropdown i must rename? msg.name = msg.payload

and write if (msg.payload =='TRUE')
msg.payload = msg.name
return msg;

Where am I wrong?

What you are doing wrong is not paying attention to the questions I've asked you.

prova
i have this