Commits

jplang  committed 7b3d9f2

Disable submit buttons when submitting a form (#6555).

  • Participants
  • Parent commits 6ce3e5f

Comments (0)

Files changed (1)

File public/javascripts/application.js

   });
 }
 
+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);