From 17170810d0b62049c32524219d7fe576a11b1e5b Mon Sep 17 00:00:00 2001 From: Will Bryant Date: Thu, 20 Oct 2011 22:54:48 +1300 Subject: [PATCH] reapply the actionpack 2.2 fix for disable-with, the original submit button's name and value need to be submitted as a hidden input --- vendor/assets/javascripts/prototype_ujs.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/vendor/assets/javascripts/prototype_ujs.js b/vendor/assets/javascripts/prototype_ujs.js index 2cd1220..9f4ddae 100644 --- a/vendor/assets/javascripts/prototype_ujs.js +++ b/vendor/assets/javascripts/prototype_ujs.js @@ -130,6 +130,19 @@ function disableFormElements(form) { form.select('input[type=submit][data-disable-with]').each(function(input) { + if (input.name == form.retrieve('rails:submit-button')) { + if (window.hiddenCommit) { + window.hiddenCommit.setAttribute('name', input.name); + window.hiddenCommit.setAttribute('value', input.value); + } else { + hiddenCommit = document.createElement('input'); + hiddenCommit.type = 'hidden'; + hiddenCommit.value = input.value; + hiddenCommit.name = input.name; + form.appendChild(hiddenCommit); + } + } + input.store('rails:original-value', input.getValue()); input.setValue(input.readAttribute('data-disable-with')).disable(); });