Forum: Ruby on Rails AJAX replace_html error

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Taylor S. (Guest)
on 2009-01-05 17:24
I have a query form that performs a complex SQL query based on form
params and then creates a bunch of @user_x collections for display
purposes.  However, AJAX is bombing out with what seems to be a simple
error.  When I submit the form, instead of replacing the desired partial
(under the form) it displays:
try {
Element.update("CONTENTS OF PARTIAL SNIPPED);'); throw e }
The partial correctly updates but something small is wrong preventing
the in-place update.

<%= javascript_include_tag :defaults %>
<% form_for :query, :url => {:action => :query_results} do |f| %>
<% form_remote_tag :url => {:action => :query_results} do %>
      <%= submit_tag "Query" %>
    <% end %>
<% end %>

  def query_results
    @conditions = conditionalize(params[:query])
    @users = User.find(:all, :conditions => @conditions)
      respond_to { |format| format.js }

page.replace_html("query_results", :partial => "query_results")
Taylor S. (Guest)
on 2009-01-05 17:27
Forgot an important part!

FORM VIEW (below form)
<% if @users %>
  <div id="query_results">
    <%= render(:partial => "query_results")%>
<% end %>
This topic is locked and can not be replied to.