Q:

Populating Rails Form Fields after an auto_complete field is populate

I am trying to create a form in Rails 2.2.2 that populates a field based on a choice a user has made in an 'auto_complete' field. It looks as though the observe_field functionality is what I need to use but I'm stuck on how to update the value of an existing text field.
The sequence of events I am trying to model is follows:
1) Use types some characters into a auto_complete field, is given a list of options and selected the relevant option.
2) The option corresponds to an ActiveRecord model and I would like to populate another field in the same form (i.e. set a default) using information from the selected ActiveRecord.
Thanks for any guidance
David

A:

I initially started to just use the observe_field functionality to observe the auto_complete_text_field value and then update another value based on the users selection as shown below but I was unable to reference the innerHtml of the text field as required by the observed_field

 'blur',
                    :frequency => 0.50,
                    :url => {:action => 'update_defaults'},
                    :with => "'reference_number=' + element.value",
                                        :update => 'form_text_field'
                     %>

To resolve the issue I ended up removing the update parameter from the observe_field and using RJS to update to the form field from within the action method instead. 
The RJS is the method looks as follows:
 render :update do |page|
    page['form_text_field'].value = @activity.units
  end

