How can I set the state of buttons when load the page

Hi,
I have a simple flow with 2 buttons. First button is general menu and button2 is a submenu. When click button1, it goes hidden and button2 came visible and viceversa. My issue is that when I load the page first time, both of them are visible.
I tried with an inject node but without success.
How can I set button2 to be hidden when load the page ?

Here is a test flow

[{"id":"8b1d019cc641df04","type":"tab","label":"test","disabled":false,"info":"","env":[]},{"id":"c4f6ad9be5ac8d9a","type":"ui_button","z":"8b1d019cc641df04","name":"","group":"b85d66818842709a","order":0,"width":0,"height":0,"passthru":false,"label":"menu","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"{\"group\":{\"hide\":[\"test_menu\"],\"show\":[\"test_menu2\"]}}","payloadType":"json","topic":"topic","topicType":"msg","x":390,"y":240,"wires":[["699208322b159740"]]},{"id":"06667493c438a667","type":"ui_button","z":"8b1d019cc641df04","name":"","group":"f57982547f0f5298","order":0,"width":0,"height":0,"passthru":false,"label":"menu2","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"{\"group\":{\"hide\":[\"test_menu2\"],\"show\":[\"test_menu\"]}}","payloadType":"json","topic":"topic","topicType":"msg","x":390,"y":400,"wires":[["699208322b159740"]]},{"id":"699208322b159740","type":"ui_ui_control","z":"8b1d019cc641df04","name":"","events":"all","x":740,"y":240,"wires":[[]]},{"id":"74e7001d6ddb6fa8","type":"inject","z":"8b1d019cc641df04","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"{\"group\":{\"hide\":[\"test_menu2\"],\"show\":[\"test_menu\"]}}","payloadType":"json","x":410,"y":520,"wires":[[]]},{"id":"b85d66818842709a","type":"ui_group","name":"menu","tab":"936d7e2f71ad862c","order":1,"disp":true,"width":"6","collapse":false,"className":""},{"id":"f57982547f0f5298","type":"ui_group","name":"menu2","tab":"936d7e2f71ad862c","order":2,"disp":true,"width":"6","collapse":false,"className":""},{"id":"936d7e2f71ad862c","type":"ui_tab","name":"test","icon":"dashboard","order":9,"disabled":false,"hidden":false}]

Here is how it appear when first open the page

Thank you

To make it so that people can help, you might want to edit your post to use the recommended way of posting flows on the Forum as the Fouum corrupts some of the characters to enable them to be read.

This post describes how to share flows in the forum: How to share code or flow json

thank you,
I changed it

You xan use ui-control to listen to page connections/refresh
e.g.

[{"id":"c4f6ad9be5ac8d9a","type":"ui_button","z":"8b1d019cc641df04","name":"","group":"b85d66818842709a","order":0,"width":0,"height":0,"passthru":false,"label":"menu","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"{\"group\":{\"hide\":[\"test_menu\"],\"show\":[\"test_menu2\"]}}","payloadType":"json","topic":"topic","topicType":"msg","x":390,"y":240,"wires":[["699208322b159740"]]},{"id":"699208322b159740","type":"ui_ui_control","z":"8b1d019cc641df04","name":"","events":"all","x":760,"y":260,"wires":[[]]},{"id":"06667493c438a667","type":"ui_button","z":"8b1d019cc641df04","name":"","group":"f57982547f0f5298","order":0,"width":0,"height":0,"passthru":false,"label":"menu2","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"{\"group\":{\"hide\":[\"test_menu2\"],\"show\":[\"test_menu\"]}}","payloadType":"json","topic":"topic","topicType":"msg","x":390,"y":300,"wires":[["699208322b159740"]]},{"id":"b2896d5020b71460","type":"change","z":"8b1d019cc641df04","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"group\":{\"hide\":[\"test_menu2\"],\"show\":[\"test_menu\"]}}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":380,"wires":[["699208322b159740"]]},{"id":"c6661e388f5df0c8","type":"ui_ui_control","z":"8b1d019cc641df04","name":"","events":"connect","x":380,"y":380,"wires":[["b2896d5020b71460"]]},{"id":"b85d66818842709a","type":"ui_group","name":"menu","tab":"936d7e2f71ad862c","order":1,"disp":true,"width":"6","collapse":false,"className":""},{"id":"f57982547f0f5298","type":"ui_group","name":"menu2","tab":"936d7e2f71ad862c","order":2,"disp":true,"width":"6","collapse":false,"className":""},{"id":"936d7e2f71ad862c","type":"ui_tab","name":"test","icon":"dashboard","order":9,"disabled":false,"hidden":false}]

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