# Text\_field\_with\_auto\_complete part II (newbie question)

**URL:** <https://www.ruby-forum.com/t/text-field-with-auto-complete-part-ii-newbie-question/61292>\
**Category:** Rails\
**Created:** [May 22, 2006, 9:12pm UTC](https://www.ruby-forum.com/t/text-field-with-auto-complete-part-ii-newbie-question/61292 "2006-05-22T21:12:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_I](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/74df32/32.png) [@John\_I](https://www.ruby-forum.com/u/John_I)\
**Post date:** [May 22, 2006, 9:12pm UTC](https://www.ruby-forum.com/t/text-field-with-auto-complete-part-ii-newbie-question/61292/1 "2006-05-22T21:12:58Z")

</div>

now that tha auto complete works (thanks Craig) I’m at a stumbling point  
again.

here’s the situation.

I have a text box that gets populated from the auto complete that has  
“ivanoff, john” and I want to add him to a list of approved users.

how do I get the id to add to the employees\_users table?  
do I need to look up the employee in the employee table or can I get  
the id from the object?  
still grasping OO

I’ve googled and googled.

thanks.

---

<div class="post-metadata">

**Author:** ![John\_I](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/74df32/32.png) [@John\_I](https://www.ruby-forum.com/u/John_I)\
**Post date:** [May 23, 2006, 3:26am UTC](https://www.ruby-forum.com/t/text-field-with-auto-complete-part-ii-newbie-question/61292/2 "2006-05-23T03:26:01Z")

</div>

On Mon, 2006-05-22 at 14:08 -0500, John I. wrote:

> still grasping OO
> 
> I’ve googled and googled.

* * *

If you look at the sample code that I included, it tosses in the ‘id’ as  
well which you can get out in your controller code with a ‘split’

Craig

---

<div class="post-metadata">

**Author:** ![John\_I](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/74df32/32.png) [@John\_I](https://www.ruby-forum.com/u/John_I)\
**Post date:** [May 23, 2006, 11:10pm UTC](https://www.ruby-forum.com/t/text-field-with-auto-complete-part-ii-newbie-question/61292/3 "2006-05-23T23:10:57Z")

</div>

I noticed that.  
In my old web thinking, I think I need to pass the ‘id’ to the  
controller so I can add them to the table.  
Do I need to populate a field in the form to pass the id to the  
controller or is there another way to get it?  
can I extract the id from the employee object?

if I need to populate a field in the form for the id, how do I add the  
id to a field when someone click on the drop down from the auto  
complete?

obviously the  
@employee = Employee.find(params[:id])  
won’t work.

but I can’t find by name because there could be more than one “jim  
jones”

ok I’m rambling…
