Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use with form button helper #123

Open
folivi opened this issue Jul 4, 2016 · 3 comments
Open

use with form button helper #123

folivi opened this issue Jul 4, 2016 · 3 comments

Comments

@folivi
Copy link

folivi commented Jul 4, 2016

hello,
how can I use it with a sumit button?

like <%= f.submit <> 'save this', class: 'btn btn-success' %>

thanks

@marcuscarey
Copy link

Try something like this:

<%= f.submit ''.html_safe + 'save this', class: 'btn btn-success' %>

@unrau
Copy link

unrau commented Sep 3, 2016

I'm trying to accomplish this as well, with no success.

I see what marcuscarey is trying to say, but it doesn't work.

@adeelejaz
Copy link

submit outputs:

<%= f.submit 'save this', class: 'btn btn-success' %>
<input class="btn btn-success" name="commit" type="submit" value="save this">

As you can see it outputs an input which means the value attribute cannot contain any HTML

I recommend using button which outputs:

<%= f.button 'save this', class: 'btn btn-success' %>
<button class="btn btn-success" name="button" type="submit">save this</button>

You can pass a block to nest HTML:

<%= f.button class: 'btn btn-success' do %>
  <i class="fa fa-..."></i>
  Save This
<% end %>
<button class="btn btn-success" name="button" type="submit">
  <i class="fa fa-..."></i>
  save this
</button>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants