# Using text\_field\_with\_auto\_complete in partials?

**URL:** <https://www.ruby-forum.com/t/using-text-field-with-auto-complete-in-partials/144353>\
**Category:** Rails\
**Created:** [July 28, 2008, 11:15pm UTC](https://www.ruby-forum.com/t/using-text-field-with-auto-complete-in-partials/144353 "2008-07-28T23:15:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mroths](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/c89c15/32.png) [@mroths](https://www.ruby-forum.com/u/mroths)\
**Post date:** [July 28, 2008, 11:15pm UTC](https://www.ruby-forum.com/t/using-text-field-with-auto-complete-in-partials/144353/1 "2008-07-28T23:15:36Z")

</div>

Anyone know how to use text\_field\_with\_auto\_complete in place of  
f.text\_field in the partial?

Using Ryan B.’ example ([#75 Complex Forms Part 3 - RailsCasts](http://railscasts.com/episodes/75)):

\<%= text\_field\_with\_auto\_complete :task\_attributes, :name, :object =\>  
task %\>

Here’s my problem…

Because it’s a partial, the id and name attributes are duplicated for  
each partial instance, so the autocomplete only works on the first  
instance of the partial, not to mention it’s invalid XHTML to have dupe  
id’s.

Each partial duplicates this:

- task:

&nbsp; **remove**

Thanks,  
Mark
