Autocomplete fill in text fields


#1

If you have an autocomplete and you have several text fields that have
the other columns from the db.

How do you autocomplete on a box and when you select it it fills in
the other text fields with the rest of the data from the table?


#2

When the autocomplete value is selected do an ajax call to your
application returning the data you need to fill in using a format you
can parse in JavaScript like JSON and set the form values.


#3

ok where do I do that at?


#4

Chris H. wrote:

ok where do I do that at?

Have you tried googling for instructions?

When I try:

http://www.google.com/search?q=rails+autocomplete

The first hit is:

http://codeintensity.blogspot.com/2008/02/auto-complete-text-fields-in-rails-2.html

Seems to me to tell you exactly what you are asking.


#5

Actually, sorry, that page indeed didn’t answer your question. Try this
one though. Googled for “rails autocomplete multiple values”

http://www.wayne-robinson.com/journal/2006/11/11/multiple-values-from-scriptaculous-autocomplete.html

This is not something I’ve done myself before though, sorry.


#6

WOW, that is cool. I cannot thank you enough. I guess I will learn to
google properly. Never though of asking for the obvious. DOH!!

On Sun, May 31, 2009 at 10:22 PM, Jonathan R. <


#7

OK, pardon my ignorance I guess. Should I do set an instance variable
for the output then use that in the RJS to populate the rest of the
text_fields with the other data? Seems that is the way to go.

On May 31, 9:56 pm, Jonathan R. <rails-mailing-l…@andreas-