# A question about text\_field\_tag value

**URL:** <https://www.ruby-forum.com/t/a-question-about-text-field-tag-value/155904>\
**Category:** Rails\
**Created:** [December 18, 2008, 2:47am UTC](https://www.ruby-forum.com/t/a-question-about-text-field-tag-value/155904 "2008-12-18T02:47:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![youhaodeyi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/b9bd4f/32.png) [@youhaodeyi](https://www.ruby-forum.com/u/youhaodeyi)\
**Post date:** [December 18, 2008, 2:47am UTC](https://www.ruby-forum.com/t/a-question-about-text-field-tag-value/155904/1 "2008-12-18T02:47:51Z")

</div>

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
