- Posts: 26
- Thank you received: 3
Ask the community, share ideas, and connect with other LimeSurvey users!
function goodbye(e) { if(document.limesurvey.move.value == '') { if(!e) e = window.event; //e.cancelBubble is supported by IE - this will kill the bubbling process. e.cancelBubble = true; e.returnValue = 'Sind Sie sicher, dass Sie die Seite verlassen möchten? Eingegebene Daten werden unter Umständen nicht gespeichert.'; //This is displayed on the dialog //e.stopPropagation works in Firefox. if (e.stopPropagation) { e.stopPropagation(); e.preventDefault(); } } } window.onload=function() { document.limesurvey.move.value = ''; } window.onbeforeunload=goodbye;
function goodbye(e) { if(!$('#submitted').length) { if(!e) e = window.event; //e.cancelBubble is supported by IE - this will kill the bubbling process. e.cancelBubble = true; e.returnValue = 'Sind Sie sicher, dass Sie die Seite verlassen möchten? Eingegebene Daten werden unter Umständen nicht gespeichert.'; //This is displayed on the dialog //e.stopPropagation works in Firefox. if (e.stopPropagation) { e.stopPropagation(); e.preventDefault(); } return 'Sind Sie sicher, dass Sie die Seite verlassen möchten? Eingegebene Daten werden unter Umständen nicht gespeichert.'; // For chrome } } window.onbeforeunload=goodbye; $(document).on('click',".button,[name='move']", function(event){ $('body').append('<input type="hidden" id="submitted" />'); });
Tested in FireFox and Chromium : limesurvey.sondages.pro/631792/newtest/Yjonsen wrote: (BTW: The code above does not seem to work yet, I will get back on that Monday...)