Bakki Kudva
2006-Dec-21 18:10 UTC
Autocomplete field in form - need string to be displayed but :id to be saved.
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 scrip.aculo.us 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. -bakki --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---