Skip to content

Make clear forms option configurable #293

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions jquery.form.js
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,10 @@ function doAjaxSubmit(e) {
}
}

// disable this when form submissions are to slow (and are cleared before actual
// submission) and the form gets replaced anyway.
$.fn.ajaxSubmit.clearFormVariables = true;

function captureSubmittingElement(e) {
/*jshint validthis:true */
var target = e.target;
Expand Down Expand Up @@ -791,7 +795,9 @@ function captureSubmittingElement(e) {
}
}
// clear form vars
setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 100);
if($.fn.ajaxSubmit.clearFormVariables) {
setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 100);
}
}


Expand Down Expand Up @@ -1040,7 +1046,7 @@ $.fn.clearFields = $.fn.clearInputs = function(includeHidden) {
else if (tag == 'select') {
this.selectedIndex = -1;
}
else if (t == "file") {
else if (t == "file") {
if (/MSIE/.test(navigator.userAgent)) {
$(this).replaceWith($(this).clone());
} else {
Expand Down