Forum: Ruby on Rails Autocomplete field in form - need string to be displayed but

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
8acba6d057b3f0c2c16cca95ad36881b?d=identicon&s=25 Bakki Kudva (bakki)
on 2006-12-21 19:11
(Received via mailing list)
Hi all,

Here's what I am trying to do. I need autocomplete text field in a
form. There are 10,000 names to choose from. But when selected I don't
want the string to be saved but the :id attribute of the model. How
can I show the string in the text_field and then swap it out for the
:id before a create or update. I see that the customized version on has both name and email address show up in the div but
only name is used in the text box. Is the email address assigned to a
hidden field?

Also, I need to do this in a lot of places in the app. Is there a way
to dry up the controller code  by putting all the autocomplete
functionality in a seperate auto_complete_controller for application
wide use.

Any help on this is greatly appreciated.

This topic is locked and can not be replied to.