Hi,
When change page without save information I received an alert.
I would like to exclude the alert on the save button (submit) but I can not and exclude it.
My code on startup_script is:
var warnMessage = "Si consiglia di salvare le modifiche prima di lasciare la pagina altrimenti andranno perse!";
$("select").change(function () {
window.onbeforeunload = function () {
return 'Attenzione.Le modifiche non salvate andranno perse!';
}
});
$("input").change(function () {
window.onbeforeunload = function () {
return 'Attenzione.Le modifiche non salvate andranno perse!';
}
});
$("textarea").change(function () {
window.onbeforeunload = function () {
return 'Attenzione.Le modifiche non salvate andranno perse!';
}
});
$(function () {
$('button[type=submit]').click(function (e) {
window.onbeforeunload = null;
});
});
function beforeUnload(evt) {
for (var name in CKEDITOR.instances) {
if (CKEDITOR.instances[name].checkDirty())
return evt.returnValue = "Attenzione.Le modifiche non salvate andranno perse!";
}
}
if (window.addEventListener)
window.addEventListener('beforeunload', beforeUnload, false);
else
window.attachEvent('onbeforeunload', beforeUnload);
Thank you,
Andrea