AJAX replace_html error


#1

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.

FORM VIEW
<%= javascript_include_tag :defaults %>
<% form_for :query, :url => {:action => :query_results} do |f| %>
FORM CONTENTS SNIPPED
<% form_remote_tag :url => {:action => :query_results} do %>
<%= submit_tag “Query” %>
<% end %>
<% end %>

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

QUERY_RESULTS.JS.RJS
page.replace_html(“query_results”, :partial => “query_results”)


#2

Forgot an important part!

FORM VIEW (below form)
<% if @users %>

<%= render(:partial => "query_results")%>
<% end %>