Forum: Ruby on Rails :after_update_element on text_field_with_auto_complete

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Jason H. (Guest)
on 2006-04-16 19:53
I have a a basic prototype coded:

#view
	<%= text_field_with_auto_complete :student, :last_name, { :size => 15
},
		:after_update_element => "alert('hello world');" %>

#controller
class ScoresController < ApplicationController
  auto_complete_for :student, :last_name
end


If I take out the :after_update_element option everything works as
advertised.  However, with :after_update_element specified nothing
works.  The ajax call to the server does not happen.

I am running Rails 1.1.2 on Mac 10.4.6 with Ruby 1.8.4.  I am testing
this with Safari.

Does anyone know why this doesn't work?
Alain R. (Guest)
on 2006-04-16 21:54
(Received via mailing list)
Jason
    > 	<%= text_field_with_auto_complete :student, :last_name, { :size
=> 15  },
    > 		:after_update_element => "alert('hello world');" %>

This is the wrong syntax: a function is expected.
Try instead:
     :after_update_element => "function(element,value){alert('You have
chosen: '+value)}"

Alan
Alain R. (Guest)
on 2006-04-16 21:57
(Received via mailing list)
oops, typo:

    > Alan
should read :
    Alain.

:)
This topic is locked and can not be replied to.