RJS Templates

I have a page that when a form gets submitted, I use page.insert_html to
stick a div in another div. The problem is, when I want to refernce it
later on, the IDs are not unique. So to get around this, I concatenated
the id of the item to the end of the div name. Which is fine. I did the
same in the RJS template as well, but it’s not finding that div.

I tried it with string interpolation thusly:

page.replace_html “divname#{@model.id}”, :partial => ‘partial_form’

And without, and neither seem to work. Does anyone know the best way to
go about handling a page with multiple records being displayed in a loop
with RJS?

Thanks for any assistance.

On Mon, Jun 19, 2006 at 11:55:15PM +0200, Guest wrote:

And without, and neither seem to work. Does anyone know the best way to
go about handling a page with multiple records being displayed in a loop
with RJS?

Pass the id as a parameter to the RJS controller method?

link_to_remote :action => “RJS method”, :id => @model.id

and in the controller

page.replace_html “divname#{params[:id]}” …

?

-jim

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs