Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dhh committed Sep 9, 2005
1 parent b063067 commit e54b4d3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
9 changes: 9 additions & 0 deletions actionpack/CHANGELOG
@@ -1,5 +1,14 @@
*SVN*

* Allow link_to_remote to use any DOM-element as the parent of the form elements to be submitted #2137 [erik@ruby-lang.nl]. Example:

<tr id="row023">
<td><input name="foo"/></td>
<td><input name="bar"/></td>
<td><%= link_to_remote 'Save', :update => "row023",
:submit => "row023", :url => {:action => 'save_row'} %></td>
</tr>

* Fixed that render :partial would fail when :object was a Hash (due to backwards compatibility issues) #2148 [Sam Stephenson]

* Fixed JavascriptHelper#auto_complete_for to only include unique items #2153 [Thomas Fuchs]
Expand Down
7 changes: 7 additions & 0 deletions actionpack/lib/action_view/helpers/javascript_helper.rb
Expand Up @@ -116,6 +116,11 @@ def link_to_function(name, function, html_options = {})
# <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
Expand Down Expand Up @@ -531,6 +536,8 @@ def options_for_ajax(options)

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
Expand Down

0 comments on commit e54b4d3

Please sign in to comment.