Reputation: 1372
I have a pretty ordinary single-page Oracle Apex application. For my main-page template, I just started from a blank page.
Under certain conditions in this Apex application, based on end-user entry, I have processing defined which branches to another Modal Dialog page in the application.
This Modal Dialog has two buttons. As desired, my application successfully sets session state on the main page depending on which button the user selects: that all works. Either button also goes so far as to close this Modal Dialog.
My problem is, back on the main page, I am looking for a Dynamic-Action-type event that will fire when my Modal Dialog closes, so I can attach a little JavaScript (.setFocus()
) to it. However, I cannot find any main-page Dynamic Action to fire upon the closing of my Modal Dialog. I've tried every kind of Dynamic Action on the main page I can think of, with an Action of "Execute JavaScript Code", and, as part of my testing, a simple
alert("here");
for the code snippet, but the JavaScript never fires.
Particularly, I've tried setting a DA on the main page's 'Dialog Closed' event, for the main-page's region from which the Modal Dialog redirect took place, but this event does not fire on my Modal Dialog closure.
I'm an Apex noob, so I feel like I'm missing something fundamental here.
Is there a way to fire my custom JS on the main page after closing a Modal Dialog? I threw up a simple app here. (apexdemo/apexdemo). I'm trying to find a way to execute JS code within my main page, after clicking the "Return" button on the Modal Dialog.
Thanks.
Upvotes: 1
Views: 4878
Reputation: 98
There is a way. On the main page in Page Designer click the Dynamic Actions tab on the left. Then right click the Dialog Closed Event and click Create Dynamic Action:
Change the Name to something meaningful, change the Selection Type to JavaScript Expression then put "window" as the JavaScript Express:
Now click on the Refresh Action on the left and change the Action to Execute JavaScript Code then add your code:
Now if you open a modal page from the page with this new Dynamic Action, then close the modal page with the a Close Dialog Dynamic Action then it will fire your JavaScript.
Kind regards.
Upvotes: 3