diff options
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 |