Forum: Ruby on Rails Autocompleter Problems

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
unknown (Guest)
on 2006-02-24 06:23
(Received via mailing list)
Hi,
I'm trying to get autocomplete to work but have been having some
problems.
It seems that Ajax.Autocompleter(...) is not getting called. I've put in
a
alert in control.js:

Autocompleter.Local = Class.create();
Autocompleter.Local.prototype = Object.extend(new Autocompleter.Base(),
{
  initialize: function(element, update, array, options) {
    window.alert("GOT CALLED");
    this.baseInitialize(element, update, options);
    this.options.array = array;
  },

This does not get called at all. My code in my view is as follows:

<%= text_field_with_auto_complete(:partner, :name,{:size=>10}) %>

which produces the javascript:

//<![CDATA[
var partner_name_auto_completer = new Ajax.Autocompleter('partner_name',
'partner_name_auto_complete',
'/partners/auto_complete_for_partner_name',
{})
//]]>

And in my controller:

class PartnersController < ApplicationController
  layout "default"
  auto_complete_for :partner, :name, :limit=>10

  def index
  	@title = "Partners"
    list
    render :action => 'list'
  end

I have liveHTTP running in the background and I'm not getting anything
in
it when I'm typing, so there are no HttpRequests happening.

Any help would be greatly appreciated.
Cheers,
Eric G.
unknown (Guest)
on 2006-02-24 06:48
(Received via mailing list)
Ok...I found my mistake.
I made the mistake of including prototype after controls. Doh!

Eric
This topic is locked and can not be replied to.