Flowdock
submit(value = "Save changes", options = {}) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Show source
Register or log in to add new notes.
June 21, 2011 - (v3.0.0 - v3.0.9)
3 thanks

Clear form

for clear a form, use this:

<%= f.submit "clear", :type => "reset" %>
March 10, 2009
1 thank

Image as a submit button

use image_sugmit_tag to use an image as a submit button

September 22, 2010
1 thank

About the options argument

The options are not documented, but of course you can use the same options than submit_tag.

Note that all non-documented options are simply passed to the input tag. Amongst other things, this allows you to change the default name attribute (commit):

form.submit 'Cancel', :name => 'cancel'

That’s very handy in forms with multiple submit buttons, this way the controller can easily check in the params which action was submitted.

November 8, 2013
0 thanks

submit button with rails javascript's onclick event handler method

Code example

<%= f.submit ‘Create User’, class: ‘buttons’, :onclick => “validate_user_form_and_submit()” %>

April 5, 2021 - (v6.0.0 - v6.1.3.1)
0 thanks

Access just the label text

One of the handiest features of `f.submit` is the auto-generated label text.

Some styling frameworks don’t lend themselves to using `f.submit` without lots of tweaking.

If you’re not using `f.submit` but still want to access the label text, note that there is a private method:

f.send(:submit_default_value)

One example (in Haml, using MaterializeCss):

.row
  .col.s6.center
    %button{ type: 'submit', name: 'commit', data: { disable: { with: 'Submitting...' } }, class: 'waves-effect waves-light btn maroon' }
      = f.send(:submit_default_value)