# Autocomplete broken after update to Rails 1.0

**URL:** <https://www.ruby-forum.com/t/autocomplete-broken-after-update-to-rails-1-0/54723>\
**Category:** Rails\
**Created:** [March 13, 2006, 6:20pm UTC](https://www.ruby-forum.com/t/autocomplete-broken-after-update-to-rails-1-0/54723 "2006-03-13T18:20:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![amin1426](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/4da419/32.png) [@amin1426](https://www.ruby-forum.com/u/amin1426)\
**Post date:** [March 13, 2006, 6:20pm UTC](https://www.ruby-forum.com/t/autocomplete-broken-after-update-to-rails-1-0/54723/1 "2006-03-13T18:20:48Z")

</div>

When I upgraded to 1.0, I broke autocomplete on a field. I’ve done  
everything that I can think of to fix the problem, but nothing has  
worked. I’m able to recreate a simple autocomplete from examples on the  
various tutorials, but my original code just will not work.

The only thing that stands out to me is the //\<![CDATA[ tag.

Any ideas?

Thanks!

---

<div class="post-metadata">

**Author:** ![amin1426](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/4da419/32.png) [@amin1426](https://www.ruby-forum.com/u/amin1426)\
**Post date:** [March 13, 2006, 7:20pm UTC](https://www.ruby-forum.com/t/autocomplete-broken-after-update-to-rails-1-0/54723/2 "2006-03-13T19:20:42Z")

</div>

> rather than try to incorporate bits of js code within your objects, why  
> not just load the javascript at the top of your view\_code\_file or  
> layout\_file completely?
> 
> i.e.
> 
> ```
> <%= javascript_include_tag :defaults %>
> 
> ```
> 
> after which, all I need to do to use autocomplete is a simple  
> definition…
> 
> \<%= text\_field\_with\_auto\_complete :placement, :cmwholename, {} %\>
> 
> and of course, have the necessary code in the controller to handle it.
> 
> Craig

That is what I’ve done. What I pasted above is the resulting code  
generated and sent to the browser. I have the following in a file  
called \_form.rhtml generated from a scaffold and further modified.

\<%= text\_field\_with\_auto\_complete :incident, :first\_party\_name %\>

The thing is this worked fine before. Now I don’t even get an error in  
the JS console.

---

<div class="post-metadata">

**Author:** ![amin1426](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/4da419/32.png) [@amin1426](https://www.ruby-forum.com/u/amin1426)\
**Post date:** [March 13, 2006, 6:31pm UTC](https://www.ruby-forum.com/t/autocomplete-broken-after-update-to-rails-1-0/54723/3 "2006-03-13T18:31:27Z")

</div>

On Mon, 2006-03-13 at 18:20 +0100, John Cabrer wrote:

> new Ajax.Autocompleter(‘incident\_first\_party\_name’,  
> ‘incident\_first\_party\_name\_auto\_complete’,  
> ‘/incidents/auto\_complete\_for\_incident\_first\_party\_name’, {})  
> //]]\>
> 
> The only thing that stands out to me is the //\<![CDATA[ tag.
> 
> Any ideas?

* * *

rather than try to incorporate bits of js code within your objects, why  
not just load the javascript at the top of your view\_code\_file or  
layout\_file completely?

i.e.

```
<%= javascript_include_tag :defaults %>

```

after which, all I need to do to use autocomplete is a simple  
definition…

\<%= text\_field\_with\_auto\_complete :placement, :cmwholename, {} %\>

and of course, have the necessary code in the controller to handle it.

Craig
