multiple_auto_complete plugin

A blog post describing a plugin I put together this morning to permit multiple auto_complete helpers on the same page.

http://www.sciwerks.com/blog/2006/09/25/multiple_auto_complete_plugin/

_Kevin

Leo Silver wrote:

_Kevin wrote: > A blog post describing a plugin I put together this morning to permit > multiple auto_complete helpers on the same page. > > http://www.sciwerks.com/blog/2006/09/25/multiple_auto_complete_plugin/ > > _Kevin

This is intresting. I have multiple auto_complete's running on the same page without any issues. You can also see an example of multiples running here:

http://demo.script.aculo.us/ajax/autocompleter_customized

-- Posted via http://www.ruby-forum.com/.

Yeah, I need to clarify that a bit. multiple auto_complete tags work fine until you try to get two that access the same model/attribute combination, then you get into trouble. This can happen if you have a form that requires multiple entries of the same type.

auto_complete_for :object, :method generates a method that tries to access Object.method. If object is 'object_1', then it will fail because it can't find that model.

text_field_for_auto_complete fires off an AJAX request to 'on_auto_complete_for_object_method'. If you specify do this.. <%= text_field_for_auto_complete :object_1, :method %> then it tries to hit a non-existent method in the controller.

_Kevin