Using inline insert_html to generate uniquely named elements


#1

Hello all,
Iâ??m using some inline rjs to add content with a unique id like so:

In the :

function add_fields() {
html = ‘

’;
html += “<%= escape_javascript(render :partial => ‘field_set’)
-%>
”;
new Insertion.After(“whatever”, html);
}

In the body:
<%= link_to_function ‘Add Fields’, update_page{|page|
page.call ‘add_fields’
} -%>

And it works, but I wish there was a more concise way to do it all in
the link_to(). Maybe by somehow including the getTime() wrapper bit
around a page.insert_html? I havenâ??t been able to get anything like that
to work, though. Any ideas?

Thanks in advanced,
Doug