Simple RJS Calls Not Working


#1

I have a simlple view:

Tags

<% unless @recipe.tags.empty? %> <%= render :partial=>'tags/tag', :collection=>@recipe.tags %>
<% end %> <% form_remote_tag :url=>tags_path(@recipe) do%> Name <%= text_field_with_auto_complete :tag, :name %> <%= submit_tag "Add Tag" %> <% end %>

Which has a pretty simple create method that renders the RJS as follows:

format.js {
render :update do |page|
page.insert_html :bottom, ‘tags’, :partial=>‘tags/tag’
end
}

The problem is that no insertion happens. Under IE I get an RJS alert,
under FF I get nothing.
Firebug reports that the POST request is successful and has the has
the correct results:

try {
new Insertion.Bottom(“tags”, "

\n Please Work\n Edit\n Delete\n\n"); } catch (e) { alert('RJS error:\n\n' + e.toString()); alert('new Insertion.Bottom(\"tags\", \"\\n Please Work\\n Edit\\n Delete\\n\\n\");\n'); throw e }

I threw the above JS into a test page and it works successfully, but
for some reason it is not working through the form. Again, in IE the
error is thrown, and in Fire Fox nothing is happenning at all. No
warnings or errors are thrown.

Anyone have any ideas on what I am doing wrong?

Thanks,
Dan


#2

Are the prototype and scriptaculous libraries listed in the head of
the layout? I imagine that without them POST will still return the RJS
but the browser wont do anything with it.

  • Richard

#3

I have the following in the top of the HTML output, via <%=
javascript_include_tag :defaults %>

IE is trying to do something with it, as the exception case is being
thrown. I have not gone down the route of adding breakpoints into the
Prototype library via Firebug to figure out what has been fired and
what has not been fired. That will be my next step.

Another note is that text_field_with_auto_complete is working fine, so
the javascript libraries are working and performing remote call
successfully. It is just my form_remote_tag and the RJS that is not
doing what I would expect it to.

The