Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 965
djsnowsill Avatar asked Dec 04 '25 08:12

djsnowsill


1 Answers

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

hope this helps :)

like image 170
Luke Avatar answered Dec 06 '25 23:12

Luke