]> source.dussan.org Git - redmine.git/commitdiff
Disable submit buttons when submitting a form (#6555).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 13 Apr 2012 17:01:46 +0000 (17:01 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 13 Apr 2012 17:01:46 +0000 (17:01 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9391 e93f8b46-1217-0410-a6f0-8f06a7374b81

public/javascripts/application.js

index 483bc1a68ce1470e1e844665986210472d6c8392..c95c34da647392fee0ca16df06760680107ea402 100644 (file)
@@ -520,4 +520,16 @@ function hideOnLoad() {
   });
 }
 
+function addFormObserversForDoubleSubmit() {
+  $$('form[method=post]').each(function(el) {
+    Event.observe(el, 'submit', function(e) {
+      var form = Event.element(e);
+      form.select('input[type=submit]').each(function(btn) {
+        btn.disable();
+      });
+    });
+  });
+}
+
 Event.observe(window, 'load', hideOnLoad);
+Event.observe(window, 'load', addFormObserversForDoubleSubmit);