GlideModal closing

chi-kwong
Giga Contributor

Is it possible to prevent a GlideModal Window from closing when the user clicks outside of the window? Ie. I want to force the user to click within the Modal. The GlideDialogWindow natively seems to have this feature but it doesn't display as nicely and I can't pin the position of the Window centrally.

Thanks

1 ACCEPTED SOLUTION

LaurentChicoine
Tera Guru

Hi, there is a method for that:



var modal = new GlideModal('page');


modal.setBackdropStatic(true);



However this is not documented in the doc so it could eventually becomes unsupported without warning. I consider this as a not so important feature so you could put it in a try catch to make sure it does not break anything. So if it becomes unsupported, the modal window will simply return to old behavior of closing when clicking outside of window.



var modal = new GlideModal('page');


try{


        modal.setBackdropStatic(true);


}


catch(e){


        console.log(e);


}


View solution in original post

5 REPLIES 5

Yes, excellent and precise answer (even 3 years later this still works!).

I have a slightly quicker way of finding out what's all available:

find_real_file.png

find_real_file.png