bug 3084745 (error when editing and changing nothing)

This commit is contained in:
Marc Delisle
2010-10-31 18:01:31 -04:00
parent 98066b6bcb
commit 91a64c1ee2

View File

@@ -291,29 +291,35 @@ $(document).ready(function() {
} }
$.post($form.attr('action'), $form.serialize(), function(data) { $.post($form.attr('action'), $form.serialize(), function(data) {
if(data.success == true) { if (typeof data.success != 'undefined') {
PMA_ajaxShowMessage(data.message); if(data.success == true) {
PMA_ajaxShowMessage(data.message);
$("#topmenucontainer") $("#topmenucontainer")
.next('div') .next('div')
.remove() .remove()
.end() .end()
.after(data.sql_query); .after(data.sql_query);
//Remove the empty notice div generated due to a NULL query passed to PMA_showMessage() //Remove the empty notice div generated due to a NULL query passed to PMA_showMessage()
var notice_class = $("#topmenucontainer").next("div").find('.notice'); var notice_class = $("#topmenucontainer").next("div").find('.notice');
if($(notice_class).text() == '') { if($(notice_class).text() == '') {
$(notice_class).remove(); $(notice_class).remove();
}
var submit_type = $form.find("select[name='submit_type']").val();
if ('insert' == submit_type || 'insertignore' == submit_type) {
//Clear the data in the forms
$form.find('input:reset').trigger('click');
}
} else {
PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : "+data.error, "7000");
} }
} else {
var submit_type = $form.find("select[name='submit_type']").val(); //happens for example when no change was done while editing
if ('insert' == submit_type || 'insertignore' == submit_type) { $('#insertForm').remove();
//Clear the data in the forms $('#topmenucontainer').after('<div id="sqlqueryresults"></div>');
$form.find('input:reset').trigger('click'); $('#sqlqueryresults').html(data);
}
}
else {
PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : "+data.error, "7000");
} }
}) })
}) // end submission of data to be inserted into table }) // end submission of data to be inserted into table