[Rails] (SOLVED) Re: piggybacking an action on an autocompleted field

Alain Ravet arav2132 at biz.tiscali.be
Sun Apr 2 10:16:18 GMT 2006


There's already a tiny patch - 3691 - in the waiting list that solves 
that very problem, and lets you write
      <%= text_field_with_auto_complete :city, :zip ,{},
	        :after_update_element=> "alert('after_update_element...')"
       %>

Alain


    http://dev.rubyonrails.org/ticket/3691
    [PATCH] Add frequency and afterupdateelement option to 
text_field_with_auto_complete

It justs adds 2 lines in the _auto_complete_field_ method 
(java_script_macros_helper.rb)
         js_options[:frequency]  = "#{options[:frequency]}" if 
options[:frequency]
         js_options[:afterUpdateElement] = "function(element,value) { 
return #{options[:after_update_element]}(element,value); }"  if 
options[:after_update_element]



More information about the Rails mailing list