Link_to_function and link_to_remote

Hi guys. I`m having this kind of problem:

i have the comments tree, there`s this link_to_function under each one:

link_to_function “Reply”,
“$(‘comment_parent_id’).setValue(#{comment.id});”

as you see it simply passes comment.id to my form.
Form looks like this :

<%form_for :comment, :url => {:controller =>'events', :action =>'post_comment'} do |f| %> <%= f.hidden_field :parent_id, :value => nil %> <%= f.text_area :comment %>
<%= f.submit "Add comment" %> <% end %>

i render both form and comments from partials.

I need to somehow change this:
link_to_function “Reply”,
“$(‘comment_parent_id’).setValue(#{comment.id});”

to link_to_remote ( i want to open the form right under the comment
after clicking the link) and keep the function to pass the comment.id

any ideas/theory/suggestions are much appreciated! Thanks!

Vlad,

I think you may want to check out the :with option for the
link_to_remote. It will allow you to pass back to the controller the
comment.id for the link that was clicked. Is that what you mean?

–Tom

On Sep 23, 1:03 pm, Vlad K. [email protected]

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