From 06a731e365011715759f46a09cb726b9f0350d00 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Tue, 29 Aug 2006 07:48:55 +0000 Subject: Keep onsubmit around for form_remote_for git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4838 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_view/helpers/prototype_helper.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_view/helpers/prototype_helper.rb b/actionpack/lib/action_view/helpers/prototype_helper.rb index 115b70d7b0..1b915882c6 100644 --- a/actionpack/lib/action_view/helpers/prototype_helper.rb +++ b/actionpack/lib/action_view/helpers/prototype_helper.rb @@ -169,7 +169,9 @@ module ActionView options[:form] = true options[:html] ||= {} - options[:html][:onsubmit] = "#{remote_function(options)}; return false;" + options[:html][:onsubmit] = + (options[:html][:onsubmit] ? options[:html][:onsubmit] + "; " : "") + + "#{remote_function(options)}; return false;" form_tag(options[:html].delete(:action) || url_for(options[:url]), options[:html]) end @@ -293,7 +295,7 @@ module ActionView javascript_options = options_for_ajax(options) update = '' - if options[:update] and options[:update].is_a?Hash + if options[:update] && options[:update].is_a?(Hash) update = [] update << "success:'#{options[:update][:success]}'" if options[:update][:success] update << "failure:'#{options[:update][:failure]}'" if options[:update][:failure] @@ -307,7 +309,7 @@ module ActionView "new Ajax.Updater(#{update}, " url_options = options[:url] - url_options = url_options.merge(:escape => false) if url_options.is_a? Hash + url_options = url_options.merge(:escape => false) if url_options.is_a?(Hash) function << "'#{url_for(url_options)}'" function << ", #{javascript_options})" -- cgit v1.2.3