RJS error using page.replace_html


#1

Using: http://licenser.de/articles/2006/07/30/ajax-scaffold-live-search

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:

<% if !removed_email_address@domain.invalid? %> <%= render :partial => 'project', :collection => @projects, :locals => { :hidden => false } %> <% end %>

… 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?