diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-09-09 08:10:20 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-09-09 08:10:20 +0000 |
commit | e54b4d3b541d9eb5717505545d93566276d7fd82 (patch) | |
tree | a17609a43fc8f3c4a27caffbbabe2ffa4bed7736 /actionpack/lib/action_view | |
parent | b0630673213ed2bee99883cb9197ddf6457a3fac (diff) | |
download | rails-e54b4d3b541d9eb5717505545d93566276d7fd82.tar.gz rails-e54b4d3b541d9eb5717505545d93566276d7fd82.tar.bz2 rails-e54b4d3b541d9eb5717505545d93566276d7fd82.zip |
Allow link_to_remote to use any DOM-element as the parent of the form elements to be submitted #2137 [erik@ruby-lang.nl]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2164 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r-- | actionpack/lib/action_view/helpers/javascript_helper.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/actionpack/lib/action_view/helpers/javascript_helper.rb b/actionpack/lib/action_view/helpers/javascript_helper.rb index 90b7100dff..3a120bf306 100644 --- a/actionpack/lib/action_view/helpers/javascript_helper.rb +++ b/actionpack/lib/action_view/helpers/javascript_helper.rb @@ -116,6 +116,11 @@ module ActionView # <tt>:before</tt>:: Called before request is initiated. # <tt>:after</tt>:: Called immediately after request was # initiated and before <tt>:loading</tt>. + # <tt>:submit</tt>:: Specifies the DOM element ID that's used + # as the parent of the form elements. By + # default this is the current form, but + # it could just as well be the ID of a + # table row or any other DOM element. def link_to_remote(name, options = {}, html_options = {}) link_to_function(name, remote_function(options), html_options) end @@ -531,6 +536,8 @@ module ActionView if options[:form] js_options['parameters'] = 'Form.serialize(this)' + elsif options[:submit] + js_options['parameters'] = "Form.serialize(document.getElementById('#{options[:submit]}'))" elsif options[:with] js_options['parameters'] = options[:with] end |