dynamic content in text_field

Hi people

I have a problem. Maybe this is something easy, but I can't figured out with my knowledge.

To explain my problem, let's supposse I have a model call User, the DB table for users

Users -id -username -age

and a model Account, where a user has many accounts and an account belongs to user. The DB table for accounts

Account -id -user_id -account_name

in my form for accounts I have a collection_select, to select a user. Then I want to have a text field for the age of the user. The idea is that when I choose a user in the collection_select, the text_field :age get filled automatically with the age of the user previously selected.

Which is the best approach to figured this out??

I hope you can help me, thanks

Which is the best approach to figured this out??

Spend a year learning javascript?