method
submit
v2.1.0 -
Show latest stable
- Class:
ActionView::Helpers::FormBuilder
submit(value = "Save changes", options = {})public
No documentation available.
# File actionpack/lib/action_view/helpers/form_helper.rb, line 749
def submit(value = "Save changes", options = {})
@template.submit_tag(value, options.reverse_merge(:id => "#{object_name}_submit"))
end 3Notes
Image as a submit button
use image_sugmit_tag to use an image as a submit button
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.
submit button with rails javascript's onclick event handler method
==== Code example <%= f.submit 'Create User', class: 'buttons', :onclick => "validate_user_form_and_submit()" %>