# Text\_field

**URL:** <https://www.ruby-forum.com/t/text-field/94367>\
**Category:** Rails\
**Created:** [May 2, 2006, 7:06pm UTC](https://www.ruby-forum.com/t/text-field/94367 "2006-05-02T19:06:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jgoza](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/5e9695/32.png) [@jgoza](https://www.ruby-forum.com/u/jgoza)\
**Post date:** [May 2, 2006, 7:06pm UTC](https://www.ruby-forum.com/t/text-field/94367/1 "2006-05-02T19:06:54Z")

</div>

Hi, All.

Is it possible to use the text\_field with an instance variable.

Controller:  
def hoge  
@value = ‘result’  
end

View:  
\<%= text\_field ‘value’ %\>

It don’t work.  
Please help.

---

<div class="post-metadata">

**Author:** ![jgoza](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/5e9695/32.png) [@jgoza](https://www.ruby-forum.com/u/jgoza)\
**Post date:** [May 3, 2006, 8:33am UTC](https://www.ruby-forum.com/t/text-field/94367/2 "2006-05-03T08:33:42Z")

</div>

\<%= text\_field ‘value’, ‘to\_s’ %\>  
Is it strange?  
Any idea?

---

<div class="post-metadata">

**Author:** ![jgoza](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/5e9695/32.png) [@jgoza](https://www.ruby-forum.com/u/jgoza)\
**Post date:** [May 3, 2006, 7:01pm UTC](https://www.ruby-forum.com/t/text-field/94367/3 "2006-05-03T19:01:14Z")

</div>

Junichi Goza wrote:

> Is it possible to use the text\_field with an instance variable.
> 
> Controller:  
> def hoge  
> @value = ‘result’  
> end
> 
> View:  
> \<%= text\_field ‘value’ %\>

You can’t use text\_field as that only works with objects. There is a  
text\_field\_tag helper method that should do the job though:

\<%= text\_field\_tag ‘value’, @value %\>

–  
Philip R.  
[http://tzinfo.rubyforge.org/](http://tzinfo.rubyforge.org/) – DST-aware timezone library for Ruby
