Hide button on dashboard form node

Hello,
I am new to using dashboards in node-red and hope someone here can assist me with the node-red-dashboard nodes.
I was wondering if there is an easy way to hide the cancel button that is inside the form node and only leave the submit\update button active.


image
I like the fast setup of using the dashboard, but most of the time I only want to make small changes like the above. If anyone can advise on the best way to make this change. If I need to use the UI template node, how do direct a hidden command to this button on this form. I tried to inspect the HTML page, but there are no ideas on that button to call directly to. Any help with this would be great.

Adding an extra image here.
image

Just delete the contents from cancel option.

3 Likes

Well that sure was an easy solution, not sure why I did not think to do that haha.
But in cause there was a case I need to make it appear and disappear, what would be the best way to handle that?

Then you'll need to make CSS classes to manipulate that button element visibility. You can use msg.className to add and remove CSS classes of dashoard widget.

[{"id":"335c379e74fcc961","type":"ui_form","z":"a248fb5a07a475d7","name":"","label":"","group":"da624dc283431947","order":0,"width":0,"height":0,"options":[{"label":"aa","value":"aa","type":"text","required":true,"rows":null},{"label":"bb","value":"bb","type":"text","required":false,"rows":null}],"formValue":{"aa":"","bb":""},"payload":"","submit":"submit","cancel":"cancel","topic":"topic","topicType":"msg","splitLayout":"","className":"","x":450,"y":230,"wires":[[]]},{"id":"f1a1ecefecdce7f4","type":"inject","z":"a248fb5a07a475d7","name":"show-cancel","props":[{"p":"className","v":"show-cancel","vt":"str"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":230,"y":190,"wires":[["335c379e74fcc961"]]},{"id":"ca61210d530f8543","type":"inject","z":"a248fb5a07a475d7","name":"hide cancel","props":[{"p":"className","v":"hide-cancel","vt":"str"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":230,"y":240,"wires":[["335c379e74fcc961"]]},{"id":"633e85819047b089","type":"ui_template","z":"a248fb5a07a475d7","group":"da624dc283431947","name":"CSS","order":1,"width":0,"height":0,"format":"<style>\n    .hide-cancel button[type=\"button\"]{\n        display:none;\n    }\n    .show-cancel button[type=\"button\"]{\n        display:inline-block;\n    }\n</style>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"global","className":"","x":250,"y":130,"wires":[[]]},{"id":"da624dc283431947","type":"ui_group","name":"Default","tab":"a54106ae4134fcbf","order":1,"disp":true,"width":"6","collapse":false,"className":""},{"id":"a54106ae4134fcbf","type":"ui_tab","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]
3 Likes

Thank you, you have been most helpful!

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