What happens when i press submit

in _form.html.erb there is submit button
<%= f.submit %>

the button is labeled “Update Tablename”.
Can someone tell me, how to change it and what exatly happens, when i
press submit?

BR
Rogi

On Feb 18, 12:24pm, rogi [email protected] wrote:

in _form.html.erb there is submit button
<%= f.submit %>

the button is labeled “Update Tablename”.
Can someone tell me, how to change it

If you pass a string to f.submit that will override the default label

and what exatly happens, when i
press submit?

The form gets submitted. What happens next depends on what your
controller does.

Fred

It will update the record with the data from" _form.html.erb" when u
press
it.

Look at the html of the form, it says for example

action= “user/create” method=“post”

it means the form will be send to the server with a post to the path
user/create
rails router it RESTful (read about
RESThttp://en.wikipedia.org/wiki/Representational_State_Transfer),
if you type rake route in the console you will
see that if rails get send that request it will send the data in the
page to
the create action
and take the values in the form and create a hash, you then have to
process
the information
in the controller.

use

f.submit ‘Your custom label’

to override. After pressing the button, you will be passed to the
action of
the form of the button you pressed.

On Fri, Feb 18, 2011 at 8:24 PM, rogi [email protected]
wrote:


You received this message because you are subscribed to the Google G.
“Ruby on Rails: Talk” group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.

On 18 February 2011 12:32, seeni khan [email protected] wrote:

It will update the record with the data from" _form.html.erb" when u press
it.

Not necessarily. It will initiate the action specified or implied by
the form_for statement. Whether that updates a record or not depends
on what is coded in that action.

Colin

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs