Forum: Ruby on Rails :after_update_element on text_field_with_auto_complete

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

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

class ScoresController < ApplicationController
  auto_complete_for :student, :last_name

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)
    > 	<%= 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)}"

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

    > Alan
should read :

This topic is locked and can not be replied to.