# How to get the content of text\_area in controller?

**URL:** <https://www.ruby-forum.com/t/how-to-get-the-content-of-text-area-in-controller/91461>\
**Category:** Rails\
**Created:** [April 9, 2007, 2:56pm UTC](https://www.ruby-forum.com/t/how-to-get-the-content-of-text-area-in-controller/91461 "2007-04-09T14:56:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![feng](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/82dd89/32.png) [@feng](https://www.ruby-forum.com/u/feng)\
**Post date:** [April 9, 2007, 2:56pm UTC](https://www.ruby-forum.com/t/how-to-get-the-content-of-text-area-in-controller/91461/1 "2007-04-09T14:56:04Z")

</div>

hi all,

i have a text\_area

\<%= text\_area :myarea, :rows =\> 20, :cols =\> 40 %\>

and want to get it’s content when submit due to form\_remote\_tag.

how can i get it’s content where user input ?

i tried

@context = params[:myarea]

and

@context = params[:myarea][:value]

and

@context = params[:myarea][:body]

and others, but just can’t work ☹

any tips is appreciated.

thanks

---

<div class="post-metadata">

**Author:** ![feng](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/82dd89/32.png) [@feng](https://www.ruby-forum.com/u/feng)\
**Post date:** [April 9, 2007, 3:07pm UTC](https://www.ruby-forum.com/t/how-to-get-the-content-of-text-area-in-controller/91461/2 "2007-04-09T15:07:03Z")

</div>

I found if I change my code in view to :

\<%= text\_area :myarea, :body :rows =\> 20, :cols =\> 40 %\>

and in controller:

@context = params[:myarea][:body]

then i can access it.

But I still don’t know why … ?

---

<div class="post-metadata">

**Author:** ![feng](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/82dd89/32.png) [@feng](https://www.ruby-forum.com/u/feng)\
**Post date:** [April 9, 2007, 6:45pm UTC](https://www.ruby-forum.com/t/how-to-get-the-content-of-text-area-in-controller/91461/3 "2007-04-09T18:45:17Z")

</div>

feng wrote:

> I found if I change my code in view to :
> 
> \<%= text\_area :myarea, :body :rows =\> 20, :cols =\> 40 %\>
> 
> and in controller:
> 
> @context = params[:myarea][:body]
> 
> then i can access it.
> 
> But I still don’t know why … ?

try text\_area\_tag instead of text\_area

---

<div class="post-metadata">

**Author:** ![feng](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/82dd89/32.png) [@feng](https://www.ruby-forum.com/u/feng)\
**Post date:** [April 11, 2007, 5:07pm UTC](https://www.ruby-forum.com/t/how-to-get-the-content-of-text-area-in-controller/91461/4 "2007-04-11T17:07:51Z")

</div>

Gokhan A. wrote:

> feng wrote:
> 
> > I found if I change my code in view to :
> > 
> > \<%= text\_area :myarea, :body :rows =\> 20, :cols =\> 40 %\>
> > 
> > and in controller:
> > 
> > @context = params[:myarea][:body]
> > 
> > then i can access it.
> > 
> > But I still don’t know why … ?
> 
> try text\_area\_tag instead of text\_area

i tried text\_area\_tag and found it is really great !

thanks very much !
