Added submit_to_remote that allows you to trigger an Ajax form submition at the click of the submission button, which allows for multiple targets in a single form through the use of multiple submit buttons #930 [yrashk@gmail.com]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1160 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
ad24c6d756
commit
f3e5e07982
|
@ -1,5 +1,7 @@
|
|||
*SVN*
|
||||
|
||||
* Added submit_to_remote that allows you to trigger an Ajax form submition at the click of the submission button, which allows for multiple targets in a single form through the use of multiple submit buttons #930 [yrashk@gmail.com]
|
||||
|
||||
* Fixed pagination to work with joins #1034 [scott@sigkill.org]
|
||||
|
||||
* Fixed that *rest parameter in map.connect couldn't accept an empty list #1037 [Dee.Zsombor@gmail.com]
|
||||
|
|
|
@ -93,6 +93,20 @@ module ActionView
|
|||
tag("form", options[:html], true)
|
||||
end
|
||||
|
||||
# Returns a button input tag that will submit form using XMLHttpRequest in tghe background instead of regular
|
||||
# reloading POST arrangement. <tt>options</tt> argument is the same as in <tt>form_remote_tag</tt>
|
||||
def submit_to_remote(name,value,options = {})
|
||||
options[:with] = 'Form.serialize(this.form)'
|
||||
|
||||
options[:html] ||= {}
|
||||
options[:html][:type] = 'button'
|
||||
options[:html][:onclick] = "#{remote_function(options)}; return false;"
|
||||
options[:html][:name] = name
|
||||
options[:html][:value] = value
|
||||
|
||||
tag("input", options[:html], false)
|
||||
end
|
||||
|
||||
def remote_function(options) #:nodoc: for now
|
||||
javascript_options = options_for_ajax(options)
|
||||
|
||||
|
|
Loading…
Reference in New Issue