Forum: Ruby on Rails RJS error using page.replace_html

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Sai E. (Guest)
on 2006-12-25 12:03
(Received via mailing list)
Using: http://licenser.de/articles/2006/07/30/ajax-scaffo...


I get an odd RJS error on both lines of the search.rjs replace_html. (I

think it's a similar error as what I get in the subforms.)

The result is two popups with the RJS error (in dev mode) and a
completely messed up output on the page, like this:

Element.update("project-tbody", "\n\n\n\n \n \n  \n  \n \n  \n  \n \n
People\n
\n \n Orgs.\n
\n \n Tasks\n
[etc]

... where there should be the properly formatted table.

The Webrick log shows this as a clue:
[2006-12-22 19:04:33] ERROR bad URI
`/%22/images/indicator.gif?1165995480\"'.

I'm sure that the error is from this line in search.rjs:
  page.replace_html scaffold_tbody_id(params), :partial => 'project',
:collection => @projects, :locals => { :hidden => false }

because switching these two lines on def search:
#    render :action => "component", :layout => false
    render :action => 'search.rjs'

- and therefore just re-rendering the whole form rather than using the
replace_html - works fine. (Though it's not very AJAXy.)

The matching section in component is:
  <tbody id="<%= scaffold_tbody_id(params) %>">
    <% if !removed_email_address@domain.invalid? %>
      <%= render :partial => 'project', :collection => @projects,
:locals => { :hidden => false } %>
    <% end %>
  </tbody>

... so as far as I can tell the page_html call looks right.

But, it doesn't work.

So, any ideas of why it's going wrong?
This topic is locked and can not be replied to.