mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Set the original button value in an attribute of the button when using the :disable_with key with submit_tag
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6270 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
62ac3279e8
commit
b1ff3b48e2
3 changed files with 4 additions and 1 deletions
|
@ -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]
|
||||
|
|
|
@ -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"]}",
|
||||
|
|
|
@ -132,7 +132,7 @@ class FormTagHelperTest < Test::Unit::TestCase
|
|||
|
||||
def test_submit_tag
|
||||
assert_dom_equal(
|
||||
%(<input name='commit' type='submit' value='Save' onclick="this.disabled=true;this.value='Saving...';alert('hello!');return (this.form.onsubmit ? (this.form.onsubmit() ? this.form.submit() : false) : this.form.submit())" />),
|
||||
%(<input name='commit' type='submit' value='Save' onclick="this.setAttribute('originalValue', this.value);this.disabled=true;this.value='Saving...';alert('hello!');return (this.form.onsubmit ? (this.form.onsubmit() ? this.form.submit() : false) : this.form.submit())" />),
|
||||
submit_tag("Save", :disable_with => "Saving...", :onclick => "alert('hello!')")
|
||||
)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue