I wanted to edit my simple_form submit button, replacing the label by a glyphicon but couldn't do it.
Is there a nice way to perform this trick ?
Many thanks !
EDIT:
Haml code with working button :
= link_to [:admin, comment], method: :delete, data:{confirm: "are you sure ?"}, class: "btn btn-sm btn-danger" do
%i.glyphicon.glyphicon-trash
But it does't work with a submit button...
The good way to do it was to simply put a button
input instead of a simple submit
one, since a button in a from submits it.
= f.button :submit do
%i.glyphicon.glyphicon-user
Add user
It actually works.
It seems that simple_form is more strict on the form submit's code structure.
for rails 4.2+ and 'simple_form (~> 3.1.0) what worked for me was changing
<%= f.button :submit, class: 'btn btn-success' %>
to
<%= f.button :button, class: 'btn btn-success' do %>
<span class="glyphicon glyphicon-ok" aria-hidden="true></span> Update Form
<% end %>
by changing
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.