Please help newb - observe_field?

thanks everyone,

I am using an autocomplete text field with associations following ryan
bates rails cast #102.

What i would like is when I autocomplete a customer name for their
“customer address” to show up in an editable text field below.

i’m currently using an observe_field, but not sure if this is the right
way.


<%= text_field_with_auto_complete :workorder, :customer_name, {}, { :url
=> formatted_customers_path(:js), :method => :get, :with => "'search=' +
element.value" } %><br />
       <%= observe_field :workorder_customer_name,
         :url => { :controller => :customers, :action => :results },
         :frequency => 3
         %>

and i’ve been playing around with some rjs and partials with no success.
I am very new to RoR, so any help would be appreciated, but it may have
to be “dumbed down” :slight_smile:

thanks for your time.

Hi Richard,

I have been posting like crazy to get achieve the same functionality.
I found the autocomplete doesn’t use a regular input tag so you can’t
use observe_field on an autocomplete field. I did however find an auto-
complete plugin that will pass the id from the model so you can use
the id to lookup your information. I’m not sure how to implement it
however. Once I get that info, I’ll let you know what I came up with.
Here’s the link to the plugin, and if you already found this, or know
what to pass to the observe_field, I would be very thankful.

http://model-ac.rubyforge.org/

modelautocompleter is the name.

On Nov 6, 12:53 pm, Richard S. [email protected]

Thanks Chris,

I’ve looked at that plugin and couldn’t firgure it out. not much
documentation for it. But it does seem like it does what I would like.
Thanks for the response, keep me posted on what you find, and I’ll do
the same.