diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-06-29 17:08:14 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-06-29 17:08:14 +0000 |
commit | 8a145b251afb2e043669cb2bf74826070f98f66d (patch) | |
tree | 3e52dae7d97722a7a9fe69832ac9f1e8864ec9bd /actionpack/lib/action_view/helpers | |
parent | 3cc47a4297d9c43e88972555e853e2d5359d804f (diff) | |
download | rails-8a145b251afb2e043669cb2bf74826070f98f66d.tar.gz rails-8a145b251afb2e043669cb2bf74826070f98f66d.tar.bz2 rails-8a145b251afb2e043669cb2bf74826070f98f66d.zip |
Give auto_complete_for parameters, fix browser-autocompletion #1550
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1566 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_view/helpers')
-rw-r--r-- | actionpack/lib/action_view/helpers/javascript_helper.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/helpers/javascript_helper.rb b/actionpack/lib/action_view/helpers/javascript_helper.rb index c73c1e08b0..607b8fe0f9 100644 --- a/actionpack/lib/action_view/helpers/javascript_helper.rb +++ b/actionpack/lib/action_view/helpers/javascript_helper.rb @@ -259,6 +259,10 @@ module ActionView # # This function expects that the called action returns a HTML <ul> list, # or nothing if no entries should be displayed for autocompletion. + # + # You'll probably want to turn the browser's built-in autocompletion off, + # su be sure to include a autocomplete="off" attribute with your text + # input field. # # Required +options+ are: # <tt>:url</tt>:: Specifies the DOM ID of the element whose @@ -310,7 +314,7 @@ module ActionView def text_field_with_auto_complete(object, method, tag_options = {}, completion_options = {}) (completion_options[:skip_style] ? "" : auto_complete_stylesheet) + - text_field(object, method, tag_options) + + text_field(object, method, { :autocomplete => "off" }.merge!(tag_options)) + content_tag("div", "", :id => "#{object}_#{method}_auto_complete", :class => "auto_complete") + auto_complete_field("#{object}_#{method}", { :url => { :action => "auto_complete_for_#{object}_#{method}" } }.update(completion_options)) end |