Colin

I've sort of done this with a Local.Autocompleter (show text and hide ID, submit ID when item is selected).
In order to do this you need to override the methods that write the resultdiv and the method that run when an item is selected.
You can override any method of the Ajax.Autocompleter by simply including your version AFTER the original code.
The browser will use your method since its the latter one. Did that help at all? ;-)

-Tommy


---------- Forwarded message ----------
From: "Colin Angevine" < [EMAIL PROTECTED]>
To: rails-spinoffs@lists.rubyonrails.org
Date: Sun, 13 Aug 2006 20:53:23 -0400
Subject: [Rails-spinoffs] Ajax.Autocompleter with a twist
Hello all,

I'm hoping to use the Ajax.Autocompleter to help users send private
messages to other users on my site. As the user types in the name of
another user, Ajax.Autocompleter steps in and offers a few relevant
options to help them along. Once they find the right one,
Scriptaculous makes it a breeze for them to select it and enter it
into the input field.

I'd like to take this one more step, however, and make note of the
user id (the primary key associated with the name they selected from
the database) as an invisible field or _javascript_ variable. With this,
it would be simple to send the private message to the appropriate user
id. The problem is that since the backend side of Ajax.Autocompleter
returns an unordered list, I don't know how/ where to store the id
numbers, or how the form could track that somehow.

All help is welcome. Thanks everyone!
-Colin

_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to