Tommy,

Thanks for getting back to me so quickly. Overriding the method in
controls.js seems like an effective approach, but after looking
through the JavaScript for almost an hour I'm having a hard time
figuring out how I should go about doing this. A few questions:

-Which method should I be overloading? Some methods work for the
mouse functionality while others deal with the keyboard, and rather
than writing this in a few times I'm hoping to just throw in a few
lines of code in one place to manage this.

-Where do you recommend I store the ID from the database? Should I
put it in the id of the <li> perhaps? What did you do?

With these two things nailed down, I think that it shouldn't be too
much of an issue to figure out how to get that ID number from the AJAX
response to store it in the main page.

Thanks,
Colin

On 8/14/06, Tommy Skaue <[EMAIL PROTECTED]> wrote:
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



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

Reply via email to