Add a CSS Class to <%= F.Submit %>

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



Leave a reply



Submit