I'm using a javascript call to dynamically remove a field from a form. My problem is that the action happens very quickly, and it's not reversible. So I'd like to add the standard Rails delete confirmation, but I can't figure out how to make it work. Basically, I want to add this ... :confirm => ‘Are you sure?’
Here's the line of javascript responsible for removing the field:
<%= link_to_function “Remove”, ”$(this).up(’.task’).remove()” %>
This is from a standard implementation of the Ryan Bates multi-model form technique from Advanced Rails Recipes.
I can provide more details if needed. Thanks.