# Problem in rendering :partial with auto\_complete\_field

**URL:** <https://www.ruby-forum.com/t/problem-in-rendering-partial-with-auto-complete-field/182147>\
**Category:** Rails\
**Created:** [January 23, 2010, 2:49pm UTC](https://www.ruby-forum.com/t/problem-in-rendering-partial-with-auto-complete-field/182147 "2010-01-23T14:49:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mcieong](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/c37758/32.png) [@mcieong](https://www.ruby-forum.com/u/mcieong)\
**Post date:** [January 23, 2010, 2:49pm UTC](https://www.ruby-forum.com/t/problem-in-rendering-partial-with-auto-complete-field/182147/1 "2010-01-23T14:49:24Z")

</div>

I wrote some codes to generate a input field with auto complete  
functionality, these codes work well in a regular form, the codes are:

=========================================================

# \<%= auto\_complete\_field( “vc\_container\_no”, :frequency =\> 0.01, :min\_chars =\> 2, :url=\>{:action=\>‘autocomplete\_vc\_cno’, :cno=\>‘OO’}, :tokens =\> ‘,’) %\>

However, when I use the same codes inside a :partial and render them  
with a  
collection, the input field still there, but the auto complete function  
no longer exist. At first I was suspecting that the problem come from  
the duplicate IDs of the and the

 after rendering the  
collection, so I add a unique no. after the IDs, but it stills doesn’t  
work.

I have worked on this problem the whole week but can not find solution,  
anyone have some idea about that? or has a sucessful experience of  
rendering :partial with auto\_complete\_field inside?

Thanks in advance.

Ieong

---

<div class="post-metadata">

**Author:** ![mcieong](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/c37758/32.png) [@mcieong](https://www.ruby-forum.com/u/mcieong)\
**Post date:** [January 23, 2010, 3:35pm UTC](https://www.ruby-forum.com/t/problem-in-rendering-partial-with-auto-complete-field/182147/2 "2010-01-23T15:35:35Z")

</div>

Mc Ieong wrote:

> I wrote some codes to generate a input field with auto complete  
> functionality, these codes work well in a regular form, the codes are:

What about showing us the not working code? In particular the partial  
and the

render :partial =\> ???, collection =\> …

Regards, T.

---

<div class="post-metadata">

**Author:** ![mcieong](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/c37758/32.png) [@mcieong](https://www.ruby-forum.com/u/mcieong)\
**Post date:** [January 24, 2010, 4:50am UTC](https://www.ruby-forum.com/t/problem-in-rendering-partial-with-auto-complete-field/182147/3 "2010-01-24T04:50:31Z")

</div>

Mc Ieong wrote:

Anyone has success experience on rendering partial with auto\_complete  
insided ??

---

<div class="post-metadata">

**Author:** ![mcieong](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/c37758/32.png) [@mcieong](https://www.ruby-forum.com/u/mcieong)\
**Post date:** [January 24, 2010, 4:50am UTC](https://www.ruby-forum.com/t/problem-in-rendering-partial-with-auto-complete-field/182147/4 "2010-01-24T04:50:37Z")

</div>

Mc Ieong wrote:

Anyone has success experience on rendering partial with auto\_complete  
insided ??

---

<div class="post-metadata">

**Author:** ![mcieong](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/c37758/32.png) [@mcieong](https://www.ruby-forum.com/u/mcieong)\
**Post date:** [January 23, 2010, 6:09pm UTC](https://www.ruby-forum.com/t/problem-in-rendering-partial-with-auto-complete-field/182147/5 "2010-01-23T18:09:44Z")

</div>

T. N. T. wrote:

> Mc Ieong wrote:
> 
> > I wrote some codes to generate a input field with auto complete  
> > functionality, these codes work well in a regular form, the codes are:
> 
> What about showing us the not working code? In particular the partial  
> and the
> 
> render :partial =\> ???, collection =\> …
> 
> Regards, T.

# index.html.erb:

 \<%= render(:partial =\> "voyage\_container", :collection =\> @voyage\_containers) %\>

# \_voyage\_container:

\<% @vc = voyage\_container %\>

 ... ...
# the auto\_complete\_field generate:

```
<script type="text/javascript">

```

//

Sorry, the codes are ugly, as I am very new to Ror…

| 

 \<%= auto\_complete\_field( "vc\_container\_no", :frequency =\> 0.01, :min\_chars =\> 2, :url=\>{:action=\>'autocomplete\_vc\_cno', :cno=\>'OO'}, :tokens =\> ',') %\> |

---

<div class="post-metadata">

**Author:** ![mcieong](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/c37758/32.png) [@mcieong](https://www.ruby-forum.com/u/mcieong)\
**Post date:** [February 7, 2010, 10:41pm UTC](https://www.ruby-forum.com/t/problem-in-rendering-partial-with-auto-complete-field/182147/6 "2010-02-07T22:41:01Z")

</div>

Mc Ieong wrote:

> Mc Ieong wrote:
> 
> Anyone has success experience on rendering partial with auto\_complete  
> insided ??

Are you using Ruby 1.9.1?  
I have the same problem when using 1.9.1 but not with 1.8.6 which works  
as it is supposed to.
