Search code examples
javascriptjqueryoracle-apex

Alert after modal page closed APEX 23.1


How can I alert a text when the close button (X) of modal dialog pressed ?

Note : I can't use dialog closed event because I want to press the X button of modal page not the cancel button !


Solution

  • Here is a way to capture the close dialog event. This fires for any type of close action: Dynamic action, Page process and "X" click.

    Put this code in the "Execute when Page Loads" attribute of the parent page.

    $(document).on( 'dialogclose', () => {
        console.log('Dialog Closed');
      } );
    

    Currently the action is just a console call, but you could bind this to a dynamic action by triggering an event

    This can also be achieved using the documented event apexafterclosecanceldialog. This is documented here.