# Autocomplete for searching using id and lists

**URL:** <https://www.ruby-forum.com/t/autocomplete-for-searching-using-id-and-lists/133701>\
**Category:** Rails\
**Created:** [April 2, 2008, 7:30pm UTC](https://www.ruby-forum.com/t/autocomplete-for-searching-using-id-and-lists/133701 "2008-04-02T19:30:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![add](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/0ea827/32.png) [@add](https://www.ruby-forum.com/u/add)\
**Post date:** [April 2, 2008, 7:30pm UTC](https://www.ruby-forum.com/t/autocomplete-for-searching-using-id-and-lists/133701/1 "2008-04-02T19:30:20Z")

</div>

I, I’m beginning in Rails and would like to know how to do 2 stuffs :

1. Using autocomplete or a select combo (specially auto\_complete) for  
searching data and then opening the results in the partial list (I would  
like to use that because I have a view and edit link in the list.rhtml)
2. I would like to use auto\_complete instead of a select box (since i  
have just too much data) so I would need to record the id of an object  
let’s say i have  
student : id, name  
class : id, student\_id, whatever  
I would like to save the student\_id in the class \_form, using auto  
complete wich would load the student name, is it possible ?  
Thanks in advance !

---

<div class="post-metadata">

**Author:** ![add](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/0ea827/32.png) [@add](https://www.ruby-forum.com/u/add)\
**Post date:** [April 2, 2008, 7:31pm UTC](https://www.ruby-forum.com/t/autocomplete-for-searching-using-id-and-lists/133701/2 "2008-04-02T19:31:35Z")

</div>

Laura Laizer smith wrote:

> I, I’m beginning in Rails and would like to know how to do 2 stuffs :
> 
> 1. Using autocomplete or a select combo (specially auto\_complete) for  
> searching data and then opening the results in the partial list (I would  
> like to use that because I have a view and edit link in the list.rhtml)
> 2. I would like to use auto\_complete instead of a select box (since i  
> have just too much data) so I would need to record the id of an object  
> let’s say i have  
> student : id, name  
> class : id, student\_id, whatever  
> I would like to save the student\_id in the class \_form, using auto  
> complete wich would load the student name, is it possible ?  
> Thanks in advance !

I have the same problem, I think you have to do 1) passing in the  
controller the fields you want …

---

<div class="post-metadata">

**Author:** ![add](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/0ea827/32.png) [@add](https://www.ruby-forum.com/u/add)\
**Post date:** [April 2, 2008, 8:08pm UTC](https://www.ruby-forum.com/t/autocomplete-for-searching-using-id-and-lists/133701/3 "2008-04-02T20:08:38Z")

</div>

On Apr 2, 2008, at 19:30 , Laura Laizer smith wrote:

> class : id, student\_id, whatever  
> I would like to save the student\_id in the class \_form, using auto  
> complete wich would load the student name, is it possible ?

Have a look at model\_auto\_completer:

```
http://agilewebdevelopment.com/plugins/model_auto_completer

```

– fxn

Disclaimer: I am the author, but I would recommend it if I wasn’t  
anyway.
