# FORM fields sent to the CONTROLLER

**URL:** <https://www.ruby-forum.com/t/form-fields-sent-to-the-controller/187097>\
**Category:** Rails\
**Created:** [April 16, 2010, 10:16pm UTC](https://www.ruby-forum.com/t/form-fields-sent-to-the-controller/187097 "2010-04-16T22:16:44Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidz101](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f0a364/32.png) [@davidz101](https://www.ruby-forum.com/u/davidz101)\
**Post date:** [April 16, 2010, 10:16pm UTC](https://www.ruby-forum.com/t/form-fields-sent-to-the-controller/187097/1 "2010-04-16T22:16:44Z")

</div>

Is there anyway to send form fields that were just filled out (after  
the user hits submit) and send those values to a contrller? Also, is  
there a way to get the values of a certain field in a table and put  
that into the contrller?

How would i do that? Thanks 🙂

---

<div class="post-metadata">

**Author:** ![davidz101](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f0a364/32.png) [@davidz101](https://www.ruby-forum.com/u/davidz101)\
**Post date:** [April 16, 2010, 10:41pm UTC](https://www.ruby-forum.com/t/form-fields-sent-to-the-controller/187097/2 "2010-04-16T22:41:19Z")

</div>

On 16 April 2010 21:15, David Z. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Is there anyway to send form fields that were just filled out (after  
> the user hits submit) and send those values to a contrller?

How can the user fill out form fields after hitting submit?

> Also, is  
> there a way to get the values of a certain field in a table and put  
> that into the contrller?

Any input fields in a form (whether in a table or not) will be sent to  
the controller on submit, unless they are empty. Try it and look in  
the log file (development.log) and you will see them in the params.

Colin

---

<div class="post-metadata">

**Author:** ![davidz101](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f0a364/32.png) [@davidz101](https://www.ruby-forum.com/u/davidz101)\
**Post date:** [April 17, 2010, 12:12am UTC](https://www.ruby-forum.com/t/form-fields-sent-to-the-controller/187097/3 "2010-04-17T00:12:40Z")

</div>

right i understand colin what you mean, but u must have mis understood  
my question-

My question is after the user hits submit, how can i transfer the  
content for the fields in the form that he just filled out- into the  
controller?

Do you understand?

FOr ex—

\<% form\_for @course do |f| %\>  
\<%= f.error\_messages %\>

\<%= f.label :title %\>  
 \<%= f.text\_field :title %\>

\<%= f.label :subtitle %\>  
 \<%= f.text\_field :subtitle %\>

\<%= f.label :body %\>  
 \<%= f.text\_area :body %\>

\<%= f.submit "Submit" %\>

\<% end %\>

Now, for example i wrote the words “foo” for all of them.

In my Courses Controller, is there a way to pass the values of the  
form fields into the controller?

---

<div class="post-metadata">

**Author:** ![davidz101](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f0a364/32.png) [@davidz101](https://www.ruby-forum.com/u/davidz101)\
**Post date:** [April 17, 2010, 10:00am UTC](https://www.ruby-forum.com/t/form-fields-sent-to-the-controller/187097/4 "2010-04-17T10:00:50Z")

</div>

On 16 April 2010 23:11, David Z. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> form fields into the controller?

As I stated in my previous mail all input field values are available  
to the controller in the params array. I think you may benefit from  
working through the rails guides at [http://guides.rubyonrails.org/](http://guides.rubyonrails.org/).  
Start with Getting Started obviously.

By the way, when replying could you insert your reply at appropriate  
point in previous email rather than at the top, it makes it easier to  
follow the thread.

Colin

---

<div class="post-metadata">

**Author:** ![davidz101](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f0a364/32.png) [@davidz101](https://www.ruby-forum.com/u/davidz101)\
**Post date:** [April 18, 2010, 3:57am UTC](https://www.ruby-forum.com/t/form-fields-sent-to-the-controller/187097/5 "2010-04-18T03:57:03Z")

</div>

wait what am I doing wrong with my posting?

---

<div class="post-metadata">

**Author:** ![davidz101](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f0a364/32.png) [@davidz101](https://www.ruby-forum.com/u/davidz101)\
**Post date:** [April 18, 2010, 10:15am UTC](https://www.ruby-forum.com/t/form-fields-sent-to-the-controller/187097/6 "2010-04-18T10:15:08Z")

</div>

On 18 April 2010 02:55, David Z. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> wait what am I doing wrong with my posting?

Are you talking about POST in rails, or email posting here? If the  
email then it is best to insert your reply into the previous email as  
I have here (after your question), rather than at the top of the mail.  
This makes it easier to follow the thread.

Colin

---

<div class="post-metadata">

**Author:** ![davidz101](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f0a364/32.png) [@davidz101](https://www.ruby-forum.com/u/davidz101)\
**Post date:** [April 19, 2010, 9:39am UTC](https://www.ruby-forum.com/t/form-fields-sent-to-the-controller/187097/7 "2010-04-19T09:39:14Z")

</div>

I think he means how he can specify where the request is going to go.  
The form\_for takes an :url paramter that lets you set the destination  
of the request.

\<% form\_for @course, :url =\> {:controller =\> ‘my\_controller’, :action  
=\> ‘my\_action’, :id =\> ‘my\_id’} do |f| %\>

---

<div class="post-metadata">

**Author:** ![davidz101](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f0a364/32.png) [@davidz101](https://www.ruby-forum.com/u/davidz101)\
**Post date:** [April 21, 2010, 12:11am UTC](https://www.ruby-forum.com/t/form-fields-sent-to-the-controller/187097/8 "2010-04-21T00:11:06Z")

</div>

Wait colin, I’m just hitting “Reply” at the bottom of the page. Isn’t  
that what I’m supposed to do?

I’m pretty sure everything is in chronological order as welll… what  
exactly do you mean?

---

<div class="post-metadata">

**Author:** ![davidz101](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f0a364/32.png) [@davidz101](https://www.ruby-forum.com/u/davidz101)\
**Post date:** [April 21, 2010, 12:13am UTC](https://www.ruby-forum.com/t/form-fields-sent-to-the-controller/187097/9 "2010-04-21T00:13:15Z")

</div>

David Z. wrote:

> Wait colin, I’m just hitting “Reply” at the bottom of the page. Isn’t  
> that what I’m supposed to do?

Yes, but then type your reply _after_ the relevant lines in the quoted  
text (as I’m doing here). This is the order in which you’d have a  
conversation.

## Best,

Marnen Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid
