Help with RJS

This should work:

page[:foo][:trogdor_id]

-Bill

Totally Girl wrote:

That won’t work because rjs is just converted to javascript then sent to the browser, so your variable would never have that id in it. You will need to pass the trogdor id in a link or as a hidden form variable.

-Bill

Totally Girl wrote:

Sure, if the user is clicking on a link to trigger the action then this works:

`<%= link_to_remote ‘Click Me’, :url => {:controller => ‘somecontroller’, :action => ‘someaction’, :trogdor_id => ‘a_trogdor_id’} %>

`

Now you can access it as params[:trogdor_id]. You could also just use :id instead of trogdor_id unless it’s being used as something else. I assume this would be done in a loop setting trogdor_id on each iteration. If this is part of a form then:

`

<%= hidden_field_tag :trogdor_id, ‘a_trogdor_id’ -%>

`Hope this helps.

-Bill

Totally Girl wrote: