diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index b315840b5b..e3632d4c86 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Set the original button value in an attribute of the button when using the :disable_with key with submit_tag, so that the original can be restored later. [Jamis Buck] + * session_enabled? works with session :off. #6680 [Catfish] * Added :port and :host handling to UrlRewriter (which unified url_for usage, regardless of whether it's called in view or controller) #7616 [alancfrancis] diff --git a/actionpack/lib/action_view/helpers/form_tag_helper.rb b/actionpack/lib/action_view/helpers/form_tag_helper.rb index 342c457917..56479dfa04 100644 --- a/actionpack/lib/action_view/helpers/form_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/form_tag_helper.rb @@ -142,6 +142,7 @@ module ActionView if disable_with = options.delete("disable_with") options["onclick"] = [ + "this.setAttribute('originalValue', this.value)", "this.disabled=true", "this.value='#{disable_with}'", "#{options["onclick"]}", diff --git a/actionpack/test/template/form_tag_helper_test.rb b/actionpack/test/template/form_tag_helper_test.rb index cc5ab1e7f4..283a86902f 100644 --- a/actionpack/test/template/form_tag_helper_test.rb +++ b/actionpack/test/template/form_tag_helper_test.rb @@ -132,7 +132,7 @@ class FormTagHelperTest < Test::Unit::TestCase def test_submit_tag assert_dom_equal( - %(), + %(), submit_tag("Save", :disable_with => "Saving...", :onclick => "alert('hello!')") ) end