Add a CSS class to %= f.submit %
<%= f.submit 'name of button here', :class => 'submit_class_name_here' %>
This should do. If you're getting an error, chances are that you're not supplying the name.
Alternatively, you can style the button without a class:
form#form_id_here input[type=submit]
Try that, as well.
Rails: How to style form submit button
Try changing your syntax to this:
<%= f.submit, id: 'create_post' %>
Whats wrong with this class addition to this rails form_for?
This is a typo error: you have an extra comma in:
f.submit, class: "btn btn-default btn-xs"
# ^ extra comma
You should use the following:
f.submit nil, class: 'btn btn-default btn-xs'
# ^ no comma
Rails: how to style submit tag with custom css
Could you do this :
=form_tag new_site_url, :method => :get do
=text_field_tag :homepage,'', type: "text", class: 'text'
=submit_tag "GO!", class: 'button'
and set the css style for the button?
It better to do this :
=form_tag new_site_url, :method => :get do |f|
=f.text_field '', type: "text", class: 'text'
=f.submit "GO!", class: 'button'
TYPO3 how to add css class to predefined submit button
You need to override the Fluid partial Form/Navigation.html
.
There you can set the classes for the different buttons in the form (navigate through different steps and/or submitting the form.
How to make a rails form_for submit button a bootstrap button
= f.submit :Submit, class: 'btn btn-success'
Add font awesome icon to rails submit
another alternative is button_tag
<%= button_tag type: 'submit', class: "button my-button", id: "register-button" do %>
<i class="fa fa-lock" aria-hidden="true"></i>
<% end %>
Related Topics
Ruby: Converting from Float to Integer in Ruby Produces Strange Results
Working with Decimals in Ruby on Rails 3
Eliminate Consecutive Duplicates of List Elements
Your Ruby Version Is 2.1.0, But Your Gemfile Specified 2.0.0
Ruby: Ssl_Connect Syscall Returned=5 Errno=0 State=Unknown State (Openssl::Ssl::Sslerror)
Getting Google File Picker to Work with Drive.File Scope
How to Store an Instance Variable Across Multiple Actions in a Controller
Why a Module's Singleton Method Is Not Visible in Downstream Eigenclasses Where It Gets Mixed
Is There Some Kind of Unseen Array Termination in Ruby
Check to See If an Array Is Already Sorted
Install Cocoapods Failed on MAC
When Do You Need a Require in a Rails Gemfile
How Does Activerecord Define Methods Compared to Attr_Accessor
What Are the Ruby Win32API Parameters | How to Pass a Null Pointer
How to Read Only X Number of Bytes of the Body Using Net::Http
Camelcase Column in Postgresql Database in Rails (Activerecord)