Skip to content

Commit 0fd0230

Browse files
authored
Merge pull request #79 from rimi-itk/hotfix/SUPPORT-1227-prevent-multiple-form-submits
SUPPORT-1227: Prevented multiple submits of a form
2 parents c3a0f3c + ed73a01 commit 0fd0230

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

themes/loop/loop.info

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ scripts[] = scripts/modernizr.min.js
1616
scripts[] = scripts/chosen.jquery.js
1717
scripts[] = scripts/use-chosen.min.js
1818
scripts[] = scripts/toggle.js
19+
scripts[] = scripts/form.js
1920

2021
; Stylesheets
2122
stylesheets[all][] = css/styles.css

themes/loop/scripts/form.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
(function($) {
2+
$(function () {
3+
// Disable all submit buttons on submit to prevent multiple
4+
// submits.
5+
// Using the "submit" event on the form is too slow (late), so we
6+
// use the "click" event on the button itself.
7+
$('form [type="submit"]').on('click', function() {
8+
$(this).closest('form').find('[type="submit"]').prop('disabled', true);
9+
});
10+
});
11+
})(jQuery);

0 commit comments

Comments
 (0)