# Auto\_complete like facebook inbox recipient select

**URL:** <https://www.ruby-forum.com/t/auto-complete-like-facebook-inbox-recipient-select/121622>\
**Category:** Rails\
**Created:** [November 29, 2007, 12:08pm UTC](https://www.ruby-forum.com/t/auto-complete-like-facebook-inbox-recipient-select/121622 "2007-11-29T12:08:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![apie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ecccb3/32.png) [@apie](https://www.ruby-forum.com/u/apie)\
**Post date:** [November 29, 2007, 12:08pm UTC](https://www.ruby-forum.com/t/auto-complete-like-facebook-inbox-recipient-select/121622/1 "2007-11-29T12:08:37Z")

</div>

Hi Guys

I am building an app that has a messaging system similar to facebook. I  
want  
to use the functionality of auto\_complete to select from a list of  
friends  
possible recipients.

I want to be able to type a name, choose from the options, add a comma,  
get  
a new list of options from the database, and choose additional  
recipients,  
without loosing the previous selections.

I could modify auto\_complete\_for\_user\_login(options = {}) to return a  
new  
selection of options from the db based only on the last part of the  
textfield value by stripping the text before the last comma before doing  
the  
call to get @items. However, when I make a selection the textfield  
value is  
replaced with the new user’s login.

Has anyone done something like this?

Regards  
Ivor

---

<div class="post-metadata">

**Author:** ![apie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ecccb3/32.png) [@apie](https://www.ruby-forum.com/u/apie)\
**Post date:** [November 29, 2007, 12:17pm UTC](https://www.ruby-forum.com/t/auto-complete-like-facebook-inbox-recipient-select/121622/2 "2007-11-29T12:17:23Z")

</div>

On Nov 29, 2007, at 12:07 PM, Ivor P. wrote:

> I am building an app that has a messaging system similar to  
> facebook. I want to use the functionality of auto\_complete to select  
> from a list of friends possible recipients.
> 
> I want to be able to type a name, choose from the options, add a  
> comma, get a new list of options from the database, and choose  
> additional recipients, without loosing the previous selections.
> 
> Has anyone done something like this?

I think that’s provided by the builtin :tokens option, as shown on  
page 545 of the Agile.

– fxn

---

<div class="post-metadata">

**Author:** ![apie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ecccb3/32.png) [@apie](https://www.ruby-forum.com/u/apie)\
**Post date:** [November 29, 2007, 12:54pm UTC](https://www.ruby-forum.com/t/auto-complete-like-facebook-inbox-recipient-select/121622/3 "2007-11-29T12:54:54Z")

</div>

Thanks Xavier!

I was wondering why google isn’t bringing up any results - should have  
gone  
to Agile from the start.

Many many thanks - the world makes sense again 🙂

Ivor
