2 Replies Latest reply on Jan 10, 2019 6:29 PM by Daljit R

    Preventing closure of APEX 5 Dialog pages using escape key - closeOnEscape

    Daljit R

      Hi,

       

      I'm utilising a series of (chained) APEX 5 Dialog pages to create a 'wizard' (process train) for a user to perform a (business) process/task.

       

      I often remove the default 'X' close option from the dialog pages as I prefer to control/encourage the flow between dialog pages and the rest of the application. I remove the 'X' currently button the approach in the linked thread below:

       

      Need help on removing Modal Dialog [x]

       

      However using this method I have noticed that dialog pages can still be closed by pressing the 'Escape' key. How can I disable this escape key close behaviour so that only the buttons provided (by me) on the dialog pages control the close/cancel behaviour. I believe this is controlled by the closeOnEscape property/option but I do not know how to integrate this approach with setting the closeOnEscape property/option to false. I know some advise against doing this but I think it is in someways worse to have the 'X' hidden and then still be able to close using the escape key anyway. If I set my dialog page(s) Dialog Attributes as follows:

       

      closeOnEscape: false, open:function(event,ui){ parent.$('.ui-button.ui-widget.ui-state-default.ui-corner-all.ui-button-icon-only.ui-dialog-titlebar-close').hide(); }
      

       

      This does result in the 'X' being hidden but pressing the escape key still closes the dialog page.

       

      Does anybody know or have any ideas on how to correctly set closeOnEscape to be false with APEX 5 dialogs?

       

      Thanks,

       

      Daljit

       

      Environment details:

       

      • APEX 5.0.4.00.12
      • Oracle 11g (11.2.0.1), CentOS 5
      • ORDS 3 - Tomcat 7
      • Internet Explorer 11 (Windows 7)
      • Universal Theme
        • 1. Re: Preventing closure of APEX 5 Dialog pages using escape key - closeOnEscape
          Franck N

          Hi,

           

          you will need to on  your modal page settings.

           

          and add this code  in  the attribute of the modal page to prevent it from closing on escape:

           

          closeOnEscape: false

           

           

          Regards,

          Franck

          1 person found this helpful
          • 2. Re: Preventing closure of APEX 5 Dialog pages using escape key - closeOnEscape
            Daljit R

            Hi Franck,

             

            Thanks for your response. From your screenshot it looks like your are using a different version to me (I'm experiencing this behaviour in v5.0.4). However, I have tried your suggestion and it does work as you suggest on apex.oracle.com (so v18.2) so it appears this could be something specific to v5.0.4. Ironically hiding the dialog close 'X' in v18.2 isn't possible using the 'usual' approach taken with v5.0.4 so I can't 'fully test' what I was hoping to achieve; although hiding the 'X' isn't recommended by some anyway so I'm re-evaluating whether there is a 'better' way.

             

            From what I've seen of APEX 5.1 and up so far, it seems a version upgrade would be worthwhile...

             

            Thanks again,

             

            Daljit