diff options
author | Scott Stewart <scott@izoca.com> | 2008-07-02 01:36:58 +0100 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2008-07-02 01:39:30 +0100 |
commit | 7378e237342443addb1691795ac9457250b6db1e (patch) | |
tree | 5047524787fb95121fccae812f66c9d4d302b659 /actionpack/lib | |
parent | 6f1d827096ad9f1044a6da7141e7ae720a64ec6b (diff) | |
download | rails-7378e237342443addb1691795ac9457250b6db1e.tar.gz rails-7378e237342443addb1691795ac9457250b6db1e.tar.bz2 rails-7378e237342443addb1691795ac9457250b6db1e.zip |
Ensure proper output when submit_tag is used with :disabled_with. [#388 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_view/helpers/form_tag_helper.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/helpers/form_tag_helper.rb b/actionpack/lib/action_view/helpers/form_tag_helper.rb index ccebec3692..bdfb2eebd7 100644 --- a/actionpack/lib/action_view/helpers/form_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/form_tag_helper.rb @@ -348,11 +348,13 @@ module ActionView options.stringify_keys! if disable_with = options.delete("disable_with") + disable_with = "this.value='#{disable_with}'" + disable_with << ";#{options.delete('onclick')}" if options['onclick'] + options["onclick"] = [ "this.setAttribute('originalValue', this.value)", "this.disabled=true", - "this.value='#{disable_with}'", - "#{options["onclick"]}", + disable_with, "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;", |