# Rjs in multiple ajax page

**URL:** <https://www.ruby-forum.com/t/rjs-in-multiple-ajax-page/58465>\
**Category:** Rails\
**Created:** [April 21, 2006, 10:37pm UTC](https://www.ruby-forum.com/t/rjs-in-multiple-ajax-page/58465 "2006-04-21T22:37:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cwd](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/da6949/32.png) [@cwd](https://www.ruby-forum.com/u/cwd)\
**Post date:** [April 21, 2006, 10:37pm UTC](https://www.ruby-forum.com/t/rjs-in-multiple-ajax-page/58465/1 "2006-04-21T22:37:06Z")

</div>

Sorry for the long explanation but I’m having trouble integrating rjs  
into my  
form page. Here’s my page:

\<%= render :partial =\> 'list\_results', :collection =\> @posts %\>

\<%= link\_to\_remote('+', :url =\> {:action =\> 'new'}, :update =\> 'new\_post', :loading =\> visual\_effect(:slide\_down, "new\_post", :duration =\> 0.5)) %\>

This works fine and the form is rendered inside “new\_post” from the  
controller using render :partial =\> ‘edit\_new’, :layout =\> false

\_edit\_new is as follows:

\<%= form\_remote\_tag(:url =\> {:action =\> ‘create’, :id =\> @post}) %\>

subject:

\<%= text\_field(:post, :subject, :width =\> 60) %\>

message:

\<%= text\_area(:post, :content, :rows =\> 15, :cols =\> 60) %\>

\<%= submit\_tag('add now') %\>

\<%= end\_form\_tag %\>

Theoretically, create.rjs is used to render this, and indeed a  
logger.debug  
shows that to be true. Here’s create.rjs:

logger.debug ‘writing rjs’  
page.insert\_html :top, ‘post\_list’, :partial =\> ‘list\_results’, :locals  
=\> {  
:list\_results =\> @post }  
page.visual\_effect :highlight, ‘post\_list’

Nothing happens! Of course I know this is one of the tough parts about  
rjs,  
but is there anything obvious that I’m missing?

Thanks

–  
View this message in context:  
[http://www.nabble.com/rjs-in-multiple-ajax-page-t1488869.html#a4033679](http://www.nabble.com/rjs-in-multiple-ajax-page-t1488869.html#a4033679)  
Sent from the RubyOnRails Users forum at [Nabble.com](http://Nabble.com).

---

<div class="post-metadata">

**Author:** ![cwd](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/da6949/32.png) [@cwd](https://www.ruby-forum.com/u/cwd)\
**Post date:** [April 21, 2006, 10:51pm UTC](https://www.ruby-forum.com/t/rjs-in-multiple-ajax-page/58465/2 "2006-04-21T22:51:13Z")

</div>

Steve R. wrote:

> Sorry for the long explanation but I’m having trouble integrating rjs  
> into my  
> form page. Here’s my page:
> 
> \<%= render :partial =\> 'list\_results', :collection =\> @posts %\>
> 
> \<%= link\_to\_remote('+', :url =\> {:action =\> 'new'}, :update =\> 'new\_post', :loading =\> visual\_effect(:slide\_down, "new\_post", :duration =\> 0.5))

Sent from the RubyOnRails Users forum at [Nabble.com](http://Nabble.com).

You have to take the :update out of the link\_to\_remote.

It will work when that it gone.

---

<div class="post-metadata">

**Author:** ![cwd](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/da6949/32.png) [@cwd](https://www.ruby-forum.com/u/cwd)\
**Post date:** [April 21, 2006, 11:14pm UTC](https://www.ruby-forum.com/t/rjs-in-multiple-ajax-page/58465/3 "2006-04-21T23:14:27Z")

</div>

It wasn’t the link\_to\_remote that was a problem. That’s straightforward  
AJAX.  
It’s the second one. However, I took your suggestion and changed the  
link\_to\_remote and created a new.rjs. It doesn’t work either. I’ve  
reduced  
this to a trivial case and that works; however, inside my real page it  
fails. Is there something that can disrupt rjs responses?

How would one know?

## Thanks

View this message in context:  
[http://www.nabble.com/rjs-in-multiple-ajax-page-t1488869.html#a4034248](http://www.nabble.com/rjs-in-multiple-ajax-page-t1488869.html#a4034248)  
Sent from the RubyOnRails Users forum at [Nabble.com](http://Nabble.com).

---

<div class="post-metadata">

**Author:** ![cwd](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/da6949/32.png) [@cwd](https://www.ruby-forum.com/u/cwd)\
**Post date:** [April 22, 2006, 7:02am UTC](https://www.ruby-forum.com/t/rjs-in-multiple-ajax-page/58465/4 "2006-04-22T07:02:35Z")

</div>

Steve R. wrote:

> It wasn’t the link\_to\_remote that was a problem. That’s straightforward  
> AJAX.  
> It’s the second one. However, I took your suggestion and changed the  
> link\_to\_remote and created a new.rjs. It doesn’t work either. I’ve  
> reduced  
> this to a trivial case and that works; however, inside my real page it  
> fails. Is there something that can disrupt rjs responses?
> 
> How would one know?
> 
> ## Thanks
> 
> View this message in context:  
> [http://www.nabble.com/rjs-in-multiple-ajax-page-t1488869.html#a4034248](http://www.nabble.com/rjs-in-multiple-ajax-page-t1488869.html#a4034248)  
> Sent from the RubyOnRails Users forum at [Nabble.com](http://Nabble.com).

I have tried using the :locals parameter with a :partial call in RJS but  
I couldn’t get it to work.

You might try a test without the :locals call, see how that goes.

Jeff C.man
