How to make a OK/Cancel Dialog open a window in a browser

I've tried everything and I am beyond confused right now. I am trying to make it so when I click on the Confirm button of my dialog (Dashboard nodes), it redirects me to a certain URL. I know I could use the UI Control node, but the thing is, I want to go to a website with a URL query parameter that changes every time the dialog opens. Does anyone know how that could be possible, to go to a URL with a {{msg.id}} as a parameter, for example?

If you mean the OK button on the ui-dashboard notification you could try this.

[{"id":"afe38a8c.1b545","type":"inject","z":"30af2d3e.d94ea2","name":"","props":[{"p":"id","v":"blue","vt":"str"},{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"test","payloadType":"str","x":130,"y":180,"wires":[["e0795033.fe1e4"]]},{"id":"e0795033.fe1e4","type":"ui_toast","z":"30af2d3e.d94ea2","position":"dialog","displayTime":"","highlight":"","sendall":false,"outputs":1,"ok":"OK","cancel":"Cancel","raw":false,"className":"","topic":"","name":"","x":280,"y":180,"wires":[["26e5d3f5.c470b4"]]},{"id":"26e5d3f5.c470b4","type":"switch","z":"30af2d3e.d94ea2","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"OK","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":460,"y":160,"wires":[["5c05235a.abc234"]]},{"id":"5c05235a.abc234","type":"template","z":"30af2d3e.d94ea2","name":"","field":"template","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<script>\n    window.open(\"https://www.google.com/search?q={{id}}\")\n</script>","output":"str","x":550,"y":80,"wires":[["be9cdcb9.6b133","b70cc618.9d4b08"]]},{"id":"be9cdcb9.6b133","type":"ui_template","z":"30af2d3e.d94ea2","group":"2d4fe667.28f8ba","name":"","order":10,"width":0,"height":0,"format":"","storeOutMessages":false,"fwdInMessages":false,"resendOnRefresh":false,"templateScope":"local","className":"","x":650,"y":160,"wires":[[]]},{"id":"b70cc618.9d4b08","type":"debug","z":"30af2d3e.d94ea2","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":690,"y":40,"wires":[]},{"id":"2d4fe667.28f8ba","type":"ui_group","name":"demo","tab":"1caa8458.b17814","order":1,"disp":true,"width":"12","collapse":false},{"id":"1caa8458.b17814","type":"ui_tab","name":"Demo","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

[edit]
You can also use html and javascript in the notification so you could also do as below. You would need to add some css styling, or give the button the same class as the ui notification buttons

[{"id":"afe38a8c.1b545","type":"inject","z":"30af2d3e.d94ea2","name":"","props":[{"p":"id","v":"blue","vt":"str"},{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"test","payloadType":"str","x":130,"y":180,"wires":[["5c05235a.abc234"]]},{"id":"5c05235a.abc234","type":"template","z":"30af2d3e.d94ea2","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<button onclick=\"window.open('https://www.google.com/search?q={{id}}')\" type=\"submit\">Search - {{id}}</button>\n","output":"str","x":170,"y":140,"wires":[["e0795033.fe1e4"]]},{"id":"e0795033.fe1e4","type":"ui_toast","z":"30af2d3e.d94ea2","position":"dialog","displayTime":"","highlight":"","sendall":true,"outputs":1,"ok":"Cancel","cancel":"","raw":true,"className":"","topic":"","name":"","x":300,"y":180,"wires":[["b70cc618.9d4b08"]]},{"id":"b70cc618.9d4b08","type":"debug","z":"30af2d3e.d94ea2","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":680,"y":160,"wires":[]}]

Thank you, aside from it only working on a singular tab due to where the dashboard-template node is located, this works perfectly!

Thanks a lot, it had been bugging me for a while

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