Topic: [solved] refactor render :update do into helper ?

Refactoring:

  def av
    render :update do |page|
      page[:erail_av].value = ' bicuspid'
      page.visual_effect :highlight, 'erail_av', :duration => 3
    end
  end

I am trying to get the above into a helper module (currently in controller):

      def change_text(div, value)
          update_page do |page|
            page[div].value = "' #{value} '" 
      #      page.visual_effect :highlight,[div], :duration => 3
          end
      end

and use this in my view:
<li><a><%= link_to_remote image_tag("aimi.jpg", :size => "30x18", :border=>0), change_text(:av, :bicuspid) %></a></li>
<li><a><%= f.text_field 'av', :id => 'erail_av', :size => 12  %></a> Cusps</li>

On click I want to remotely update the text in the field id="erail_av" with value 'bicuspid'.


Above solution doesn't work. What would be the correct helper method for this ?

Last edited by ediestel (2007-12-14 18:31:09)

Re: [solved] refactor render :update do into helper ?

it works with

link_to_function   in stead of link_to_remote