Skip to content
Snippets Groups Projects
Commit 0b72762e authored by Emmanuel Viennet's avatar Emmanuel Viennet
Browse files

Formulaire jury BUT: vérifie sortie sans enregistrement (JS) #425

parent 99a9b236
No related branches found
No related tags found
No related merge requests found
...@@ -59,4 +59,29 @@ $(function () { ...@@ -59,4 +59,29 @@ $(function () {
} }
} }
}); });
\ No newline at end of file
// ----- Etat du formulaire jury pour éviter sortie sans enregistrer
let FORM_STATE = "";
// Une chaine décrivant l'état du form
function get_form_state() {
let codes = [];
// il n'y a que des <select>
document.querySelectorAll("select").forEach(sel => codes.push(sel.value));
return codes.join();
}
$('document').ready(function () {
FORM_STATE = get_form_state();
});
function is_modified() {
return FORM_STATE != get_form_state();
}
window.addEventListener("beforeunload", function (e) {
if (is_modified()) {
var confirmationMessage = 'Changements non enregistrés !';
(e || window.event).returnValue = confirmationMessage;
return confirmationMessage;
}
});
# -*- mode: python -*- # -*- mode: python -*-
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
SCOVERSION = "9.4.19" SCOVERSION = "9.4.20"
SCONAME = "ScoDoc" SCONAME = "ScoDoc"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment