aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers/form_tag_helper.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2007-02-06 17:48:38 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2007-02-06 17:48:38 +0000
commit06b1198736498f2ba97b5e0a38f3264d45201aeb (patch)
tree41c1aa2b8242d80915d67b47732fe52cc4fc71c7 /actionpack/lib/action_view/helpers/form_tag_helper.rb
parent9f31ecb4c98fd4c50bb5e6624af2b4b866e96afd (diff)
downloadrails-06b1198736498f2ba97b5e0a38f3264d45201aeb.tar.gz
rails-06b1198736498f2ba97b5e0a38f3264d45201aeb.tar.bz2
rails-06b1198736498f2ba97b5e0a38f3264d45201aeb.zip
Fix that FormTagHelper#submit_tag using :disable_with should trigger the onsubmit handler of its form if available [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6134 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_view/helpers/form_tag_helper.rb')
-rw-r--r--actionpack/lib/action_view/helpers/form_tag_helper.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/helpers/form_tag_helper.rb b/actionpack/lib/action_view/helpers/form_tag_helper.rb
index 3b0e555bbd..7f77788d41 100644
--- a/actionpack/lib/action_view/helpers/form_tag_helper.rb
+++ b/actionpack/lib/action_view/helpers/form_tag_helper.rb
@@ -141,7 +141,12 @@ module ActionView
options.stringify_keys!
if disable_with = options.delete("disable_with")
- options["onclick"] = "this.disabled=true;this.value='#{disable_with}';this.form.submit();#{options["onclick"]}"
+ options["onclick"] = [
+ "this.disabled=true",
+ "this.value='#{disable_with}'",
+ "#{options["onclick"]}",
+ "return (this.form.onsubmit ? this.form.onsubmit() : true)",
+ ].join(";")
end
tag :input, { "type" => "submit", "name" => "commit", "value" => value }.update(options.stringify_keys)