This is my code
<%= link_to_function ("Add another url", :id=> "add_another_url_link_id") do |page|
page.insert_html :bottom ,:add_another_url, :partial =>'add_another_url', :locals => {:object =>Url.new, :url => section}
end%>
Here i am showing add_another_url
partial under the bottom of add_another_ur div
.
I have a list. At the end of row i am showing this link. When i click the link that will show form under the row. But when i click the link that is showing the form under the first row only.
I want to show the form for corresponding row. (I don't know how to use 'this' in this place)
Can Anyone help me.
I assume you generate this link for every row in your list. This is a bad idea because it will generate the same element id (add_another_url_link_id) for every row which is not valid html.
You should either generate individual ids:
<%- @items.each do |item| %>
<%= link_to_function "Add another url", :id => "add_url_for_item_#{item.id}" do |page| %>
...
And use the specific id to find the relevant row.