Siddick Ebramsha wrote:

Solution :-     <%= link_to_function("Add a follow-up date for this note?", nil, :id => "show_link") do |page|               page[:follow_up_date_select].visual_effect :toggle_appear               page[:show_link].replace_html "Hide date select"      end %>

That worked.

I've set up link_to_function with a block that inserts a chunk of html from a partial when the link is clicked -- namely a data select. I'm wondering if I can use the same block to replace the link that's executing the function?

For example, after a user clicks on "Add a follow-up-date" and the date select appears, is there an easy way for me to replace the link with a "nevermind" or something that can then removed the date select? Or should I have the partial render a button that takes it away, instead of trying to update the add link? Here's the exact code I'm using now.

<%= link_to_function("Add a follow-up date?", nil, :id => "add_follow_up_link") do |page|       page.insert_html :after, 'add_follow_up_link', :partial => 'follow_up'       page.visual_effect :toggle_appear, "follow_up_date_select"     end %>

And here's the partial:

<span id="follow_up_date_select" style="display:none">   <%= date_select (:action_date, :order => [:month, :day, :year]) %> </span>

My instinct is to just add a button in the partial that will call another javascript function to take this away. But the other problem with leaving the add link functioning on the page after it's been clicked is that if a user accidentally clicks on it again, the partial is rendered again and I have two identical date_selects on the page.