Issue: #58 displays error if QSO form isnt empty
这个提交包含在:
父节点
0065e9fe0e
当前提交
fa62dbc2f1
共有 1 个文件被更改,包括 37 次插入 和 0 次删除
|
|
@ -276,6 +276,43 @@ function settime () {
|
|||
$(document).ready(function(){
|
||||
|
||||
/* On Page Load */
|
||||
var catcher = function() {
|
||||
var changed = false;
|
||||
$('form').each(function() {
|
||||
if ($(this).data('initialForm') != $(this).serialize()) {
|
||||
changed = true;
|
||||
$(this).addClass('changed');
|
||||
} else {
|
||||
$(this).removeClass('changed');
|
||||
}
|
||||
});
|
||||
if (changed) {
|
||||
return 'Unsaved QSO!';
|
||||
}
|
||||
};
|
||||
|
||||
$(function() {
|
||||
$('form').each(function() {
|
||||
$(this).data('initialForm', $(this).serialize());
|
||||
}).submit(function(e) {
|
||||
var formEl = this;
|
||||
var changed = false;
|
||||
$('form').each(function() {
|
||||
if (this != formEl && $(this).data('initialForm') != $(this).serialize()) {
|
||||
changed = true;
|
||||
$(this).addClass('changed');
|
||||
} else {
|
||||
$(this).removeClass('changed');
|
||||
}
|
||||
});
|
||||
if (changed && !confirm('You have an unsaved QSO. Continue with QSO?')) {
|
||||
e.preventDefault();
|
||||
} else {
|
||||
$(window).unbind('beforeunload', catcher);
|
||||
}
|
||||
});
|
||||
$(window).bind('beforeunload', catcher);
|
||||
});
|
||||
|
||||
$.get('qso/band_to_freq/' + $('.band').val() + '/' + $('.mode').val(), function(result) {
|
||||
$('#frequency').val(result);
|
||||
|
|
|
|||
正在加载…
在新工单中引用