Close Modal after Push Button


Is it possible with a script that after opening a modal to a series of new buttons, that once I push a button inside that modal it’ll close the modal and return to the homepage. Here is a bad gif showing what I was thinking.

You can do that with a script widget, here is a minimal example session : modalcloser.json (2.7 KB)

The script widget takes the button’s value as input (value property) and sets the modal’s value to 0 when it receives 1 from the button.

1 Like

Thank you Jean!

Worked perfectly and thank you for providing an example. Couldn’t of figured it out without it haha!

I modified it just a little so I can add every button in the modal into one script instead of having multiple scripts. Hopefully I did it right as it seems to be working, so I believe so! Here what I modified incase anyone else was interested.

For the script I just added each value of the buttons and same with the target values.

if (value == 70, 71, 72, 73, 74, 75) set("modal_6",0)

Then for the values I added each button ID right after.


Great ! Your condition does not look right though, it’s always true (value == 70, 71, 72, 73, 74, 75 returns 75, a “truthy” value. Anyway, you can get rid of the condition since the script will only be called when the buttons are pressed !

1 Like