Autocomplete field in form - need string to be displayed but

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.