# Form\_remote\_tag spewing JS error

**URL:** <https://www.ruby-forum.com/t/form-remote-tag-spewing-js-error/135021>\
**Category:** Rails\
**Created:** [April 17, 2008, 8:34am UTC](https://www.ruby-forum.com/t/form-remote-tag-spewing-js-error/135021 "2008-04-17T08:34:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![S-gw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@S-gw](https://www.ruby-forum.com/u/S-gw)\
**Post date:** [April 17, 2008, 8:34am UTC](https://www.ruby-forum.com/t/form-remote-tag-spewing-js-error/135021/1 "2008-04-17T08:34:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![S-gw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@S-gw](https://www.ruby-forum.com/u/S-gw)\
**Post date:** [April 17, 2008, 8:45am UTC](https://www.ruby-forum.com/t/form-remote-tag-spewing-js-error/135021/2 "2008-04-17T08:45:18Z")

</div>

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
