Permalink
Browse files

Merge pull request #1 from mreishus/master

Prevent beforeunload feature from double submitting when clicking submit
  • Loading branch information...
2 parents d129264 + 37ba311 commit c578b0ad23810057cb33bd6c84de09734daeebed @zeroasterisk committed Oct 4, 2011
Showing with 11 additions and 0 deletions.
  1. +11 −0 jquery.autosaveform.js
View
@@ -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) {

0 comments on commit c578b0a

Please sign in to comment.