I have a modal screen that opens fine with button code as below:
I would like to get the modal screen to open programatically. I am using the code as below:
This does not work.
How should I do this?
Mike
I have a modal screen that opens fine with button code as below:
I would like to get the modal screen to open programatically. I am using the code as below:
This does not work.
How should I do this?
Mike
Hey @mdsmith1,
I think the method you're looking for is modalFrame5.setHidden(false) (documentation here).
In all honesty, I do think modal.show and modal.hide are a bit confusing and they should work. However I've never used them and it seems setHidden is the way to go.
Hey Mike, can you confirm where you are running this code. This seems to be within a SQL query which would not have access to the retool js context?
Hi Miguel;
Unfortunately modalFrame5.setHidden(false)
generates an error message.
I looked at the documentation and I can't find a better way of doing this.
Mike
Hey @mdsmith1! You have the correct syntax but can't execute a JS expression from within a SQL procedure, as @jamesg31 pointed out. You should instead use a dedicated JS query or event handler script.
Under what kind of conditions do you want to trigger the modal?
Darren:
OK, thanks very much for this.
I have marked your answer as a Solution.
Thanks again.
Mike