FORM fields sent to the CONTROLLER

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 :slight_smile:

On 16 April 2010 21:15, David Z. [email protected] 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

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?

On 16 April 2010 23:11, David Z. [email protected] 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/.
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

wait what am I doing wrong with my posting?

On 18 April 2010 02:55, David Z. [email protected] 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

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| %>

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?

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
[email protected]