:after_update_element and text_field_with_auto_complete


#1

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


#2

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


#3

Am I totally misunderstanding something here or…
Please help! - I’m really stuck on this!