Rjs in multiple ajax page


#1

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
Sent from the RubyOnRails Users forum at Nabble.com.


#2

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.

You have to take the :update out of the link_to_remote.

It will work when that it gone.


#3

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
Sent from the RubyOnRails Users forum at Nabble.com.


#4

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
Sent from the RubyOnRails Users forum at 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