# How to get the value of a text field

**URL:** <https://www.ruby-forum.com/t/how-to-get-the-value-of-a-text-field/172545>\
**Category:** Rails\
**Created:** [July 23, 2009, 5:13am UTC](https://www.ruby-forum.com/t/how-to-get-the-value-of-a-text-field/172545 "2009-07-23T05:13:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Xiahong\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/3d9bf3/32.png) [@Xiahong\_G](https://www.ruby-forum.com/u/Xiahong_G)\
**Post date:** [July 23, 2009, 5:13am UTC](https://www.ruby-forum.com/t/how-to-get-the-value-of-a-text-field/172545/1 "2009-07-23T05:13:46Z")

</div>

Hi everyone,

I need to get the value of one text field when clicking “next page”.  
My code looks like:

this is the view page:  
\<% form\_tag(‘javascript:void(0)’) do  
%\>

```
<%= text_field_tag 'search' %>

<%=

```

observe\_field :search,  
:frequency =\>  
0.5,  
:update =\>  
‘my\_friends’,  
:url =\> {:action =\>  
‘search’},  
:with =\> “‘search=’ + encodeURIComponent  
(value)” %\>  
\<% end %\>  
\<% end %\>

\<% @friends.each do |friend| %\> \<%= friend.name %\> \<% end %\> \<%= will\_paginate @friends, :params =\> {:search =\> ???? } %\>

The problem is: I dont know how to pass the value of the search text  
field to \<%= will\_paginate @friends, :params =\> {:search =\> ??? } %\>.  
Can anyone help me out??

thanks  
xiahong
