diff --git a/javascript/LeftAndMain_right.js b/javascript/LeftAndMain_right.js index 58a4dbd1..75c62167 100755 --- a/javascript/LeftAndMain_right.js +++ b/javascript/LeftAndMain_right.js @@ -382,30 +382,18 @@ function autoSave(confirmation, callAfter) { }); if(__somethingHasChanged) { - var options = { - save: function() { - statusMessage('saving...', '', true); - var i; - for(i=0;i<__forms.length;i++) { - if(__forms[i].isChanged && __forms[i].isChanged()) { - if(i == 0) __forms[i].save(true, __callAfter); - else __forms[i].save(true); - } - } - }, - discard: function() { - __forms.each(function(form) { form.resetElements(false); }); + if(confirmation ) { + if(confirm("Are you sure you want to navigate away from this page?\n\nWARNING: Your changes have not been saved.\n\nPress OK to continue, or Cancel to stay on the current page.")) + { + // OK was pressed, call function for what was clicked on if(__callAfter) __callAfter(); - }, - cancel: function() { + } else { + // Cancel was pressed, stay on the current page their stuff + return true; } + } else { + options.save(); } - - /** - * Fix the modal dialog! - */ - if(confirmation ) doYouWantToSave(options); - else options.save(); } else { if(__callAfter) __callAfter();