I''m testing out this new autocomplete helper, but have not had any success on "custom" autocompletes. Following the example outlined at http://script.aculo.us/demos/ajax/autocompleter_customized, I have the following: # controller def auto_complete_for_author_name @authors = Author.find( :all, :conditions => [''LOWER(last_name) LIKE '', ''%'' + @params[:author][:name] + ''%'' ], :order => ''last_name ASC'', :limit => 10 ) render :partial => ''search_results'' end # view <html> <head> <%= javascript_include_tag "prototype" %> <%= javascript_include_tag "controls" %> <%= javascript_include_tag "effects" %> </head> <body> Author Search: <%= text_field_with_auto_complete( :author, :name, {}, :skip_style => true ) %> </body> </html> # _search_results.rhtml (partial) <ul class="authors"> <% for author in @authors do -%> <li class="author"> <div class="name"><%= author.name %></div> </li> <% end -%> </ul> When I type something in the text field, I get a JS error: Error: element.className has no properties Source File: http://www.mydomain.com/javascripts/prototype.js Line: 456 It seems it is trying to remove the class name from one of the elements, but I can''t tell which one, and why it is failing. Anyone have any idea what I''m doing wrong here? Matt
Hi, as I cannot recreate this problem, can you put up a live version somewhere? Maybe PM me on the IRC channel. thx, Thomas Am 07.07.2005 um 16:31 schrieb Belorion:> I''m testing out this new autocomplete helper, but have not had any > success on "custom" autocompletes. > > Following the example outlined at > http://script.aculo.us/demos/ajax/autocompleter_customized, I have the > following: > > # controller > def auto_complete_for_author_name > @authors = Author.find( :all, :conditions => [''LOWER(last_name) > LIKE '', ''%'' + @params[:author][:name] + ''%'' ], :order => ''last_name > ASC'', :limit => 10 ) > render :partial => ''search_results'' > end > > # view > <html> > <head> > <%= javascript_include_tag "prototype" %> > <%= javascript_include_tag "controls" %> > <%= javascript_include_tag "effects" %> > </head> > <body> > Author Search: > <%= text_field_with_auto_complete( :author, :name, {}, :skip_style > => true ) %> > </body> > </html> > > > # _search_results.rhtml (partial) > <ul class="authors"> > <% for author in @authors do -%> > <li class="author"> > <div class="name"><%= author.name %></div> > </li> > <% end -%> > </ul> > > > When I type something in the text field, I get a JS error: > > Error: element.className has no properties > Source File: http://www.mydomain.com/javascripts/prototype.js > Line: 456 > > It seems it is trying to remove the class name from one of the > elements, but I can''t tell which one, and why it is failing. Anyone > have any idea what I''m doing wrong here? > > Matt > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
> When I type something in the text field, I get a JS error: > > Error: element.className has no properties > Source File: http://www.mydomain.com/javascripts/prototype.js > Line: 456I''ve got the same situation... have you solved this problem? Thanks, Enrico -- "The only thing necessary for the triumph of evil is for good men to do nothing" Edmund Burke
hi, I''ve read on the ml about an issue on "autocomplete js error". I''ve got the same error: Error: element.className has no properties> Source File: http://www.mydomain.com/javascripts/prototype.js> Line: 456 I''m almost sure I''ve followed all the steps. I''ve checked everything twice and I still can''t figure out why I get the error... This is in the view where the input is supposed to autocomplete: <input autocomplete="off" id="cliente_ragionesociale" name="cliente[ragionesociale]" size="15" type="text" /> <div class="auto_complete" id="cliente_ragionesociale_auto_complete"> </div> <script type="text/javascript">new Ajax.Autocompleter(''cliente_ragionesociale'', ''cliente_ragionesociale_auto_complete'', ''/opzioni/auto_complete_for_cliente_ragionesociale'', {}) </script> The prototype js file is headed with: Prototype JavaScript framework, version 1.3.1 I''ve got the same Belorion''s problem, I was wondering if you were able to help him. Thanks for your help. Enrico -- "The only thing necessary for the triumph of evil is for good men to do nothing" Edmund Burke
Today I''ve created a brand new project trying to setup the autocomplete and I''ve found out a bad huge error: I was assuming that .search written in the example was a standard method. It wasn''t, and that error was messing up and creating the js error. the end :-) Enrico -- "The only thing necessary for the triumph of evil is for good men to do nothing" Edmund Burke