Sorry for the long explanation but I''m having trouble integrating rjs
into my
form page. Here''s my page:
<div id="posts">
<ul id="post_list"><%= render :partial =>
''list_results'', :collection =>
@posts %></ul>
<p><%= link_to_remote(''+'',
:url => {:action => ''new''},
:update => ''new_post'',
:loading => visual_effect(:slide_down, "new_post", :duration
=> 0.5))
%></p>
</div>
<div id="new_post">
</div>
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}) %>
<p>subject:</p>
<p><%= text_field(:post, :subject, :width => 60) %></p>
<p>message:</p>
<p><%= text_area(:post, :content, :rows => 15, :cols => 60)
%></p>
<p><%= submit_tag(''add now'') %></p>
<%= 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.
Steve Ross wrote:> Sorry for the long explanation but I''m having trouble integrating rjs > into my > form page. Here''s my page: > > <div id="posts"> > <ul id="post_list"><%= render :partial => ''list_results'', :collection => > @posts %></ul> > <p><%= 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. -- Posted via http://www.ruby-forum.com/.
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.
Steve Ross 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 Coleman -- Posted via http://www.ruby-forum.com/.
Maybe Matching Threads
- problem setting expectation for test with delayed::job
- Sample Merb App
- Unable to figure out why a photo attribute of the paperclip plugin is not being passed in as a param
- RESTful Routing: Getting names of resources out of paths
- AJAX not displaying - due to action not complete?