Issue: #58 displays error if QSO form isnt empty

这个提交包含在:
Peter Goodhall 2011-10-21 20:22:54 +01:00
父节点 0065e9fe0e
当前提交 fa62dbc2f1

查看文件

@ -276,6 +276,43 @@ function settime () {
$(document).ready(function(){ $(document).ready(function(){
/* On Page Load */ /* 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) { $.get('qso/band_to_freq/' + $('.band').val() + '/' + $('.mode').val(), function(result) {
$('#frequency').val(result); $('#frequency').val(result);