A question about text_field_tag value

This is my rails code:

<%= label_tag ‘user_name_label’, ‘User Name:’ %>
<%= text_field_tag ‘user_name’, ‘’%>

<%= label_tag ‘view_name_label’, ‘View Name:’%>
<%= text_field_tag ‘view_name’, ‘’ %>

I defined a user name text field and a view name text field. The view
name text field is based on the user name text field value. So I need to
add a function to listen to the user input on user name text field and
whenever the value changed, it should change the view name text field
accordingly. How can I set the listen function?

thanks

Zhao Yi