Lets say I have a form with multiple task elements, for adding tasks
to a project, and a link_to_function which inserts a new task using
<%= link_to_function "Add Task" do |page|
page.insert_html :bottom, :tasks, :partial => 'task', :object =>
I know when I do a render collection that each partial has a
partial_name_counter variable eg: task_counter, but when I create a
it defaults to 1 (as it was when the partial was rendered into the
Thanks in advance.
If you want that ID in order to remove the newly added task, you can
use Prototype’s up function. Please take a look at
#74 Complex Forms Part 2 - RailsCasts.
Not sure if this is what you are trying to do.
Thats a good idea I’ll check it out,
What i am actually doing is using the spry framework to provide
validation on the textfield and unfortunately it has to be applied on
a per id basis, not on all elements of a certain class, so therefor i
need to be able to set a unique id to each task input field or
containing div (as spry can be applied to a div then auto assign to