diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-06-21 07:08:13 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-06-21 07:08:13 +0000 |
commit | e59bfc85196cc4921f87b4b145048b7fa1fbbabb (patch) | |
tree | aa69e122de7c17a3bfa09139ea9016fc70f7dd81 /actionpack/lib/action_view | |
parent | 1e0d9a642ffe5db23086301d3eeed63f4b7bca68 (diff) | |
download | rails-e59bfc85196cc4921f87b4b145048b7fa1fbbabb.tar.gz rails-e59bfc85196cc4921f87b4b145048b7fa1fbbabb.tar.bz2 rails-e59bfc85196cc4921f87b4b145048b7fa1fbbabb.zip |
Added a fall-through action for form_remote_tag that'll be used in case Javascript is unavailable #1459 [Scott Barron]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1464 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r-- | actionpack/lib/action_view/helpers/javascript_helper.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/actionpack/lib/action_view/helpers/javascript_helper.rb b/actionpack/lib/action_view/helpers/javascript_helper.rb index 11f513c01c..d5e2a8b2dc 100644 --- a/actionpack/lib/action_view/helpers/javascript_helper.rb +++ b/actionpack/lib/action_view/helpers/javascript_helper.rb @@ -97,11 +97,19 @@ module ActionView # reloading POST arrangement. Even though it's using Javascript to serialize the form elements, the form submission # will work just like a regular submission as viewed by the receiving side (all elements available in @params). # The options for specifying the target with :url and defining callbacks is the same as link_to_remote. + # + # A "fall-through" target for browsers that doesn't do Javascript can be specified with the :action/:method options on :html + # + # form_remote_tag :html => { :action => url_for(:controller => "some", :action => "place") } + # + # By default the fall-through action is the same as the one specified in the :url (and the default method is :post). def form_remote_tag(options = {}) options[:form] = true options[:html] ||= {} options[:html][:onsubmit] = "#{remote_function(options)}; return false;" + options[:html][:action] = options[:html][:action] || url_for(options[:url]) + options[:html][:method] = options[:html][:method] || "post" tag("form", options[:html], true) end |