From 43c677b4892aed0e6b8168ce9340b8811a3d6027 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Fri, 13 Apr 2012 17:01:46 +0000 Subject: [PATCH] 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 --- public/javascripts/application.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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); -- 2.39.5