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 Goodwin
Ok...I found my mistake. I made the mistake of including prototype after controls. Doh! Eric> 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 Goodwin > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >