Auto Populate data in text field based on input provided in ruby on rails

I need to populate data in text filed based on given input.Below the code i am working on.


    '<%= f.label "Name:"%> <%= f.text_field :emp_name %>
    <%= f.label "Emp Id:" %> <%= f.text_field :emp_id %>
    <%= f.label "Roll:" %> <%= f.text_field :emp_roll %>' 

If i am entering employee name in text field,it has to fetch emp_id and emp_roll value from sqlite data base and populate its value in respective text fields in the same form. How to implement this?