R – Populating Rails Form Fields after an auto_complete field is populate

rubyruby-on-rails

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

Best Answer

There's a Railscasts episode for this: http://railscasts.com/episodes/88

hope this helps :)

Related Topic