mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Added that FormTagHelper#submit_tag will return to its original state if the submit fails and you're using :disable_with [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6480 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
2a305949d7
commit
0228975a4e
3 changed files with 6 additions and 2 deletions
|
@ -1,5 +1,7 @@
|
|||
*SVN*
|
||||
|
||||
* Added that FormTagHelper#submit_tag will return to its original state if the submit fails and you're using :disable_with [DHH]
|
||||
|
||||
* Cleaned up, corrected, and mildly expanded ActionPack documentation. Closes #7190 [jeremymcanally]
|
||||
|
||||
* Small collection of ActionController documentation cleanups. Closes #7319 [jeremymcanally]
|
||||
|
|
|
@ -138,7 +138,9 @@ module ActionView
|
|||
"this.disabled=true",
|
||||
"this.value='#{disable_with}'",
|
||||
"#{options["onclick"]}",
|
||||
"return (this.form.onsubmit ? (this.form.onsubmit() ? this.form.submit() : false) : this.form.submit())",
|
||||
"result = (this.form.onsubmit ? (this.form.onsubmit() ? this.form.submit() : false) : this.form.submit())",
|
||||
"if (result == false) { this.value = this.getAttribute('originalValue'); this.disabled = false }",
|
||||
"return result",
|
||||
].join(";")
|
||||
end
|
||||
|
||||
|
|
|
@ -138,7 +138,7 @@ class FormTagHelperTest < Test::Unit::TestCase
|
|||
|
||||
def test_submit_tag
|
||||
assert_dom_equal(
|
||||
%(<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())" />),
|
||||
%(<input name='commit' type='submit' value='Save' onclick="this.setAttribute('originalValue', this.value);this.disabled=true;this.value='Saving...';alert('hello!');result = (this.form.onsubmit ? (this.form.onsubmit() ? this.form.submit() : false) : this.form.submit());if (result == false) { this.value = this.getAttribute('originalValue'); this.disabled = false };return result" />),
|
||||
submit_tag("Save", :disable_with => "Saving...", :onclick => "alert('hello!')")
|
||||
)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue