Forum: Ruby on Rails autocomplete fill in text fields

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
8133ee52ca72188132b5c7d97dfb967f?d=identicon&s=25 Chris Habgood (chabgood)
on 2009-05-29 06: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?
8a2967ca2df7285045c83f023c4849e1?d=identicon&s=25 jay (Guest)
on 2009-05-29 18: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.
8133ee52ca72188132b5c7d97dfb967f?d=identicon&s=25 Chris Habgood (chabgood)
on 2009-05-29 18:52
(Received via mailing list)
ok where do I do that at?
0f50b9a2ad85666d537d39bda49327ee?d=identicon&s=25 Jonathan Rochkind (jrochkind)
on 2009-06-01 04:56
Chris Habgood 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-com...

Seems to me to tell you exactly what you are asking.
8133ee52ca72188132b5c7d97dfb967f?d=identicon&s=25 Chris Habgood (chabgood)
on 2009-06-01 05: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 Rochkind <rails-mailing-l...@andreas-
0f50b9a2ad85666d537d39bda49327ee?d=identicon&s=25 Jonathan Rochkind (jrochkind)
on 2009-06-01 05:22
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/m...

This is not something I've done myself before though, sorry.
8133ee52ca72188132b5c7d97dfb967f?d=identicon&s=25 Chris Habgood (chabgood)
on 2009-06-01 05: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 Rochkind <
This topic is locked and can not be replied to.