| Module | ActionView::Helpers::FormTagHelper |
| In: |
lib/form_submit_tag_helper.rb
|
Aplico el parche rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/1955 para que funcione bien con IE6.
# File lib/form_submit_tag_helper.rb, line 8
8: def submit_tag(value = "Save changes", options = {})
9: options.stringify_keys!
10:
11: if disable_with = options.delete("disable_with")
12: disable_with = "this.value='#{disable_with}'"
13: disable_with << ";#{options.delete('onclick')}" if options['onclick']
14:
15: options["onclick"] = "if (window.hiddenCommit) { window.hiddenCommit.setAttribute('value', this.value); }"
16:
17: # options["onclick"] << "else { hiddenCommit = this.cloneNode(false);hiddenCommit.setAttribute('type', 'hidden');this.form.appendChild(hiddenCommit); }"
18: options["onclick"] << "else { hiddenCommit = document.createElement('input');hiddenCommit.type = 'hidden';"
19: options["onclick"] << "hiddenCommit.value = this.value;hiddenCommit.name = this.name;this.form.appendChild(hiddenCommit); }"
20:
21: options["onclick"] << "this.setAttribute('originalValue', this.value);this.disabled = true;#{disable_with};"
22: options["onclick"] << "result = (this.form.onsubmit ? (this.form.onsubmit() ? this.form.submit() : false) : this.form.submit());"
23: options["onclick"] << "if (result == false) { this.value = this.getAttribute('originalValue');this.disabled = false; }return result;"
24: end
25:
26: if confirm = options.delete("confirm")
27: options["onclick"] ||= ''
28: options["onclick"] << "return #{confirm_javascript_function(confirm)};"
29: end
30:
31: tag :input, { "type" => "submit", "name" => "commit", "value" => value }.update(options.stringify_keys)
32: end