From: Jean-Philippe Lang Date: Fri, 13 Apr 2012 17:01:46 +0000 (+0000) Subject: Disable submit buttons when submitting a form (#6555). X-Git-Tag: 2.0.0~198 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=43c677b4892aed0e6b8168ce9340b8811a3d6027;p=redmine.git Disable submit buttons when submitting a form (#6555). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9391 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 483bc1a68..c95c34da6 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -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);