Form_remote_tag spewing JS error

I have a page with a search form using a form_remote_for where I want
the search results to display below the form. Everything is mostly
working, but instead of getting fomatted output, I get a JS error
message. That message actually seems to hold the data I want (I see
evidence of the search results in the jibberish).

My first foray in using Ajax with Rails, and I have two other instances
with remote_link_to working finr, but this one I just can’t see what’s
different about it to cause it to fail.

----------- ERROR -----------

try { Element.update(“searchResults”, "\074h1\076Search Results…
} catch (e) { alert(‘RJS error:\n\n’ + e.toString());
alert('Element.update(“searchResults”,… throw e }

#— FORM PARTIAL ------

<% form_remote_tag(:url => {:action => ‘search_results’ },
:html => {:id => ‘stdSearchForm’},
:update => ‘searchResults’) do -%>

 --- yadda ---

<% end -%>

#— CONTROLLER -------

def search_results
@search_list = Child.get_list(params)
respond_to do |request_format|
request_format.js
end
end

#— RJS FILE ------------

page.replace_html(“searchResults”,
:partial => (@app_site_paths.panels + ‘child_search_results’),
:locals => {:search_list => @search_list})

#— HTML FILE ---------

<%= yield :main %>

The error string actually shows in in the searchResults

I’ve looked at my code, compared to books & blogs & my working examples,
and I just don’t see what’s wrong.

Ideas ??

– gw

Greg W. wrote:

I have a page with a search form using a form_remote_for where I want
the search results to display below the form. Everything is mostly
working, but instead of getting fomatted output, I get a JS error
message. That message actually seems to hold the data I want (I see
evidence of the search results in the jibberish).

Doh. This is a case where :update should not be specified in the form
tag.

Works now.

– gw

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs