Simple_form: f.submit and f.button :submit don't work with raw("<tag>Value</tag>"), output markup as well

Created on 18 Feb 2013  路  4Comments  路  Source: heartcombo/simple_form

Two examples, one not working and a working one, expected the first to follow similar pattern as the second one...

<%= f.submit raw("<i class='icon-white icon-ok'></i> Update"), ... %>

<%= link_to raw("<i class='icon-white icon-trash'></i> Delete my account"), ... %>

Screen Shot 2013-02-18 at 1 07 23 PM

Most helpful comment

@fabianoalmeida Rails 3.2 doesn't support block in button helper https://github.com/rails/rails/blob/v3.2.12/actionpack/lib/action_view/helpers/form_helper.rb#L1402 but Rails 4 will support it thanks to this commit so you'll be able to write something like:

<%= f.button :submit do %>
  <i class='icon-white icon-ok'></i> Update
<% end %>

as a workaround you can use button_tag for now:

<%= button_tag do %>
  <i class='icon-white icon-ok'></i> Update
<% end %>

All 4 comments

@victorbstan I guess your code is wrong. Try to remove , after f.submit and reload your page.

Just a typo. Fixed in the description now but doesn't change anything.

@fabianoalmeida Rails 3.2 doesn't support block in button helper https://github.com/rails/rails/blob/v3.2.12/actionpack/lib/action_view/helpers/form_helper.rb#L1402 but Rails 4 will support it thanks to this commit so you'll be able to write something like:

<%= f.button :submit do %>
  <i class='icon-white icon-ok'></i> Update
<% end %>

as a workaround you can use button_tag for now:

<%= button_tag do %>
  <i class='icon-white icon-ok'></i> Update
<% end %>

:+1: thanks

Was this page helpful?
0 / 5 - 0 ratings