Can someone help with jquery in Apex Oracle? I want to call on a modal page in Apex when a text or change has been made to a page and the user tries to navigate away before saving.
It's similar to the onbeforeunload here, except I want it to call on a modal page I create instead of using a Window's window.
$(document).ready(function() {
formmodified=0;
$('form *').change(function(){
formmodified=1;
});
window.onbeforeunload = confirmExit;
function confirmExit() {
if (formmodified == 1) {
return "New information not saved. Do you wish to leave the page?";
}
}
});
There are two methods of closing a Modal Dialog in Oracle Apex, closing and canceling. Before you close a dialog you could always run some validations, for example that the user has to accept that unsaved changes will get lost.
What you probably want is to override the ondialogclose javascript event. Here is an example of how to override the dialog onclose event.. Just put any logic that needs to be executed before closing there.