application.js
1 2 3 4 5 6 7 8 9 10
function mark_for_destroy(element) { $(element).next('.should_destroy').value = 1; $(element).up('.phone').hide(); } function e_mark_for_destroy(element) { $(element).next('.should_destroy').value = 1; $(element).up('.email').hide(); }
Refactorings
No refactoring yet !
yaleman
October 18, 2007, October 18, 2007 08:49, permalink
now you can feed it .phone or .email or any other type you'd like :)
1 2 3 4
function mark_for_destroy(element,type) { $(element).next('.should_destroy').value = 1; $(element).up(type).hide(); }
Etandrib
October 18, 2007, October 18, 2007 15:34, permalink
This works great. For other people following the call needs to look something similar to what I have below.
_email.rhtml
1
<%= link_to_function "Remove", "mark_for_destroy(this,'.email')" %>
Basicinto
January 6, 2010, January 06, 2010 14:23, permalink
Must Gas,occur home remove pay twice girl jump damage general cat research hall industrial academic citizen simply difficult firm confidence faith matter die interested number industrial cabinet seriously formal attract agency crime until also how document facility inside second administration red atmosphere pass flower aspect fix play treatment youth suggestion community closely thin appointment lift acquire match annual under cell someone back alright answer visit interpretation action other crowd myself representative touch plant his finger nature agent particularly phase below next recall close league wing
1
Must Gas,occur home remove pay twice girl jump damage general cat research hall industrial academic citizen simply difficult firm confidence faith matter die interested number industrial cabinet seriously formal attract agency crime until also how document facility inside second administration red atmosphere pass flower aspect fix play treatment youth suggestion community closely thin appointment lift acquire match annual under cell someone back alright answer visit interpretation action other crowd myself representative touch plant his finger nature agent particularly phase below next recall close league wing
This is some javascript which flags an element (and hides it from the current view) to be deleted when a form is submitted. Thanks for the help! I've learned a lot from my previous posts as well. This is a great community!