Forum: Ruby on Rails Autocomplete broken after update to Rails 1.0

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
8559d0a815c0c7a11f8a19538bf336c6?d=identicon&s=25 John Cabrer (jcabrer)
on 2006-03-13 18:20
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.

<input id="incident_first_party_name" name="incident[first_party_name]"
size="30" type="text" value="" /><div class="auto_complete"
id="incident_first_party_name_auto_complete"></div><script
type="text/javascript">
//<![CDATA[
new Ajax.Autocompleter('incident_first_party_name',
'incident_first_party_name_auto_complete',
'/incidents/auto_complete_for_incident_first_party_name', {})
//]]>
</script>

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

Any ideas?

Thanks!
C1e5a9e9344b6d31b9df7303e6dc378a?d=identicon&s=25 Craig White (Guest)
on 2006-03-13 18:31
(Received via mailing list)
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', {})
> //]]>
> </script>
>
> 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
8559d0a815c0c7a11f8a19538bf336c6?d=identicon&s=25 John Cabrer (jcabrer)
on 2006-03-13 19:20
> 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 %></p>

The thing is this worked fine before.  Now I don't even get an error in
the JS console.
This topic is locked and can not be replied to.