Forum: Ruby on Rails autocomplete fill in text fields

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.
Chris H. (Guest)
on 2009-05-29 08:37
(Received via mailing list)
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?
jay (Guest)
on 2009-05-29 20:30
(Received via mailing list)
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.
Chris H. (Guest)
on 2009-05-29 20:52
(Received via mailing list)
ok where do I do that at?
Jonathan R. (Guest)
on 2009-06-01 06:56
Chris H. wrote:
> ok where do I do that at?

Have you tried googling for instructions?

When I try:

The first hit is:

Seems to me to tell you exactly what you are asking.
Chris H. (Guest)
on 2009-06-01 07:19
(Received via mailing list)
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-
Jonathan R. (Guest)
on 2009-06-01 07:22
Actually, sorry, that page indeed didn't answer your question. Try this
one though. Googled for "rails autocomplete multiple values"

This is not something I've done myself before though, sorry.
Chris H. (Guest)
on 2009-06-01 07:51
(Received via mailing list)
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. <
This topic is locked and can not be replied to.