# Using auto\_complete on multiple text\_fields within a form

**URL:** <https://www.ruby-forum.com/t/using-auto-complete-on-multiple-text-fields-within-a-form/177044>\
**Category:** Rails\
**Created:** [October 10, 2009, 9:33am UTC](https://www.ruby-forum.com/t/using-auto-complete-on-multiple-text-fields-within-a-form/177044 "2009-10-10T09:33:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul\_Singh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/4bbf92/32.png) [@Paul\_Singh](https://www.ruby-forum.com/u/Paul_Singh)\
**Post date:** [October 10, 2009, 9:33am UTC](https://www.ruby-forum.com/t/using-auto-complete-on-multiple-text-fields-within-a-form/177044/1 "2009-10-10T09:33:18Z")

</div>

I’ve got a model with a number of attributes – a bicycle with all of  
the various components on it. When the user enters the bike’s make and  
model (among other things), I want to make sure that we don’t  
duplicate a brand name (for example: Fuji is a single brand and it  
would suck to have Fuji, fujee and fUGI in the DB somehow).

I’ve been tinkering with the auto\_complete plugin and have managed to  
get it to work for a single attribute of the bike model. Is there a  
way to get it to work with multiple fields within the same form?

If there’s an alternative way to handle this, I’m all ears!

---

<div class="post-metadata">

**Author:** ![Paul\_Singh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/4bbf92/32.png) [@Paul\_Singh](https://www.ruby-forum.com/u/Paul_Singh)\
**Post date:** [October 10, 2009, 6:51pm UTC](https://www.ruby-forum.com/t/using-auto-complete-on-multiple-text-fields-within-a-form/177044/2 "2009-10-10T18:51:41Z")

</div>

Paul Singh wrote:

> ```
> I've got a model with a number of attributes -- a bicycle 
> with all of
> the various components on it. When the user enters the bike's make and
> model (among other things), I want to make sure that we don't
> duplicate a brand name (for example: Fuji is a single brand and it
> would suck to have Fuji, fujee and fUGI in the DB somehow).
> 
> I’ve been tinkering with the auto\_complete plugin and have managed to  
> get it to work for a single attribute of the bike model. Is there a  
> way to get it to work with multiple fields within the same form?
> 
> If there’s an alternative way to handle this, I’m all ears!
> ```

Why not just give a select list of the brands.&nbsp; You can make up a table with all the brands (with maybe an 'other' for strange ones) and make a select list from that that the user can pick from.&nbsp; That way you will not get alternative versions.  
  
Norm  
  
--~--~---------~--~----~------------~-------~--~----~  
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.   
 To post to this group, send email to removed\_email\_address@domain.invalid   
 To unsubscribe from this group, send email to removed\_email\_address@domain.invalid   
 For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en  
-~----------~----~----~----~------~----~------~--~---
