Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Prevent beforeunload feature from double submitting when clicking submit #1

Merged
merged 1 commit into from

2 participants

@mreishus

No description provided.

@zeroasterisk zeroasterisk merged commit c578b0a into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 11 additions and 0 deletions.
  1. +11 −0 jquery.autosaveform.js
View
11 jquery.autosaveform.js
@@ -176,6 +176,17 @@ $.fn.ASF_debug = true; # turn on debug messages in console
}
return false;
});
+
+ // If using unload feature, deregister a form from autosaving upon unload
+ if ($.fn.ASF_beforeunload) {
+ $(form).submit(function() {
+ var ASF_forms = $(window).data("ASF_forms");
+ ASF_forms = $.map(ASF_forms, function(x) {
+ return x === form ? null : x;
+ });
+ $(window).data("ASF_forms", ASF_forms);
+ });
+ }
});
// activate ASF_beforeunload (if not already done)
if ($.fn.ASF_beforeunload) {
Something went wrong with that request. Please try again.