auto_complete never completes, does nothing.

My setup = Rails 2.0, Prototype '1.6.0.2'.

I have a simple implementation of auto_complete that for whatever reason never fires off an ajax request. I found this in the 'controls.js':

this.element.setAttribute('autocomplete','off');

I commented this out, still nothing.

Here's my code:

View: <%= text_field_with_auto_complete :player, :name_last, { :min_chars => 1 } %>

Controller: auto_complete_for :player, :name_last

Is there something I'm missing here? I had a colleague look into this (veteran rails developer) and he was bewildered.

I've also tried using different objects and fields with the same result.

Do you load the JavaScript libraries?

-- fxn

Xavier Noria wrote:

Everything looks fine.

The HTML autocomplete attribute is turned off to avoid triggering browser builtin autocompletion. Leave that off.

The option :min_chars goes in the wrong hash:

    text_field_with_auto_complete(       object,       method,       tag_options = {},       completion_options = {}     )

but that should fire the call anyway. You end up with and HTML min_chars attribute, but that does not prevent the Ajax request from being issued.

How did you check no Ajax request is sent?

-- fxn

Xavier Noria wrote:

Have you moved forward?

check out your application.rb file and if there is protect_from_forgery then just comment it.

In that case the request would fail, but it would be a request in firebug.

Download the latest from scriptaculous and unizip it and put it in your public/javascript folder and overwrite the file that exist there already. And in your view file make sure to include <%=javascript_include_tag 'default' %> <%=javascript_include_tag 'prototype' %>

It works for me. Hopefully, it works for you as well.

I have the same problem as Matt, am running Rails2 via Aptana RadRails, and have tried the various suggestions to no avail. Has anyone successfully set this up on Rails 2?

Sure.

Success! I had ignored this suggestion from Mr. Bless because I had just installed it on the console via "script/plugin install auto_complete". What I failed to realize is that for whatever reason, this does not install the latest version. When I downloaded the archive from scriptalicious, everything worked as expected!

Thanks Mr. Bless.

Check out my blog, http://www.tipninja.com where I share tips from optimizing your PC use, to cooking and food storage and household organization to personal happiness.

Great, I just now found time to revisit this thread i started. I temporarily abandoned the app I was developing on when I had this problem but will check it out asap. Thanks guys.

matt

glenviewjeff wrote:

Excuse my ignorance but where can I grab the latest version of auto_complete? I poked around the Scriptaculious site with no luck.. pages weren't loading or erroring.. thanks in advance.

Matt Sales wrote:

Matt:

Go to http://script.aculo.us, then click on "downloads page," in the "Get it Already" bubble. Then click on your favorite archive format (zip/gz/etc.) in the middle bubble labeled "current version."

Jeff