From 0228975a4ecfaf81e8d8b8662abdc91ff67dbf42 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Tue, 27 Mar 2007 19:42:54 +0000 Subject: 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 --- actionpack/lib/action_view/helpers/form_tag_helper.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_view/helpers/form_tag_helper.rb b/actionpack/lib/action_view/helpers/form_tag_helper.rb index 417b0fd4b7..a230c28a68 100644 --- a/actionpack/lib/action_view/helpers/form_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/form_tag_helper.rb @@ -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 -- cgit v1.2.3