Forum: Ruby on Rails :after_update_element and 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.
E44cf90ad27e4e092c75d25ae9e0563f?d=identicon&s=25 Peter Jeppesen (jeppesen)
on 2009-01-06 14:53
Hi!
I'm on Rails 2.2.2 and using text_field_with_auto_complete which works
fine.

Now I want to use :after_update_element to send some data back to the
server when my text field is updated.

I have the following code in my view:

<%= text_field_with_auto_complete :company, :name, {},
      {:after_update_element =>
    "function(element,value){" + remote_function(
    :url => { :action => :update_search_session },
    :with =>"'selected_company_name='+element.value") + "}",
    :skip_style => false, :method => :get }
%>

I can see that my controller method (:update_search_session) gets called
allright but I can't figure out how to access the returned data
(element.value).

Can anyone help?

TIA, Peter
E44cf90ad27e4e092c75d25ae9e0563f?d=identicon&s=25 Peter Jeppesen (jeppesen)
on 2009-01-07 19:34
Am I totally misunderstanding something here or...
Please help! - I'm really stuck on this!
E44cf90ad27e4e092c75d25ae9e0563f?d=identicon&s=25 Peter Jeppesen (jeppesen)
on 2009-01-08 19:31
Peter Jeppesen wrote:
> Am I totally misunderstanding something here or...
> Please help! - I'm really stuck on this!

OK finally I got it sorted out.
After a minor bugfix in my javascript, params[:selected_company_name]
did the trick.

Amazing and smooth... - I just love Rails!

Peter
This topic is locked and can not be replied to.