How to retrieve data from ui dropdown on button click

Hello, I want to retrieve the selected data from 2 ui dropdowns when I click on an ui button, is that possible ?
image

1 Like

Store the dropdown values in flow context as they happen. Then when the button is pressed, get the values out of flow context.

1 Like

https://nodered.org/docs/user-guide/context

That should help ^.

Also search this forum for store dropdown in context.

1 Like

thanks I'll try it

I kind of get lost, could you be more clear ? If you have an example it will help more, thanks in advance

Like this maybe

[{"id":"fe000015.cb567","type":"ui_dropdown","z":"428922dd.2ac0ac","name":"","label":"Select 1","tooltip":"","place":"Select option 1","group":"86228.687a5dd88","order":2,"width":0,"height":0,"passthru":true,"options":[{"label":"A","value":"A","type":"str"},{"label":"B","value":"B","type":"str"}],"payload":"","topic":"S1","x":370,"y":560,"wires":[["4824b297.cf378c"]]},{"id":"5c0814e2.f909cc","type":"ui_button","z":"428922dd.2ac0ac","name":"","group":"86228.687a5dd88","order":4,"width":0,"height":0,"passthru":false,"label":"button","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":380,"y":680,"wires":[["3c943ed0.3fd552"]]},{"id":"e8a2dda2.21b51","type":"ui_dropdown","z":"428922dd.2ac0ac","name":"","label":"Select 2","tooltip":"","place":"Select option 2","group":"86228.687a5dd88","order":2,"width":0,"height":0,"passthru":true,"options":[{"label":"C","value":"C","type":"str"},{"label":"D","value":"D","type":"str"}],"payload":"","topic":"S2","x":380,"y":620,"wires":[["4824b297.cf378c"]]},{"id":"4824b297.cf378c","type":"join","z":"428922dd.2ac0ac","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"1","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":560,"y":580,"wires":[["a3d05155.f4a6c"]]},{"id":"a3d05155.f4a6c","type":"change","z":"428922dd.2ac0ac","name":"","rules":[{"t":"set","p":"selected","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":750,"y":580,"wires":[[]]},{"id":"3c943ed0.3fd552","type":"change","z":"428922dd.2ac0ac","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"selected","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":680,"wires":[["b8dae18b.dfdc1"]]},{"id":"b8dae18b.dfdc1","type":"debug","z":"428922dd.2ac0ac","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":810,"y":680,"wires":[]},{"id":"86228.687a5dd88","type":"ui_group","z":"","name":"Default","tab":"e006699.f40dd98","disp":true,"width":"6","collapse":false},{"id":"e006699.f40dd98","type":"ui_tab","z":"","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]
2 Likes

Thanks a lot it solved the problem :smiley: