mirror of
https://github.com/unraid/webgui.git
synced 2026-04-28 05:49:35 -05:00
Fix: only add "confirm-leave" when form has it specified
This commit is contained in:
@@ -945,8 +945,10 @@ $(function() {
|
||||
form.find('input[value="<?=_("Done")?>"],input[value="Done"]').not('input.lock').val("<?=_('Reset')?>").prop('onclick',null).off('click').click(function(){formHasUnsavedChanges=false;refresh(form.offset().top);});
|
||||
});});
|
||||
// add leave confirmation when form has changed without applying (opt-in function)
|
||||
$('form.js-confirm-leave').on('change',function(e){formHasUnsavedChanges=true;}).on('submit',function(e){formHasUnsavedChanges=false;});
|
||||
$(window).on('beforeunload',function(e){if (formHasUnsavedChanges) return '';}); // note: the browser creates its own popup window and warning message
|
||||
if ($('form.js-confirm-leave').length>0) {
|
||||
$('form.js-confirm-leave').on('change',function(e){formHasUnsavedChanges=true;}).on('submit',function(e){formHasUnsavedChanges=false;});
|
||||
$(window).on('beforeunload',function(e){if (formHasUnsavedChanges) return '';}); // note: the browser creates its own popup window and warning message
|
||||
}
|
||||
// form parser: add escapeQuotes protection
|
||||
$('form').each(function(){
|
||||
var action = $(this).prop('action').actionName();
|
||||
|
||||
Reference in New Issue
Block a user