2

I'm trying to get the font awesome icon to show in my delete button in my laravel form.

Here is the delete button

{{ Form::submit('<i class="fa fa-pencil"></i> Delete', array('class' => 'btn btn-danger', 'role' => 'button')) }}

4 Answers4

2

When you use Form::submit, the content is always escaped. You can use Form::button instead, which does not escape the content.

Your code can be tweaked to:

{{ Form::button('<i class="fa fa-pencil"></i> Delete', ['class' => 'btn btn-danger', 'role' => 'button', 'type' => 'submit']) }}

Also make sure to set type = submit while using Form::button.

haris
  • 3,775
  • 1
  • 25
  • 28
1
    {{Form::button(' Se connecter<i class="fa fa-key icon-on-right"></i>', array(
                        'type' => 'submit',
                        'class'=> 'pull-right btn btn-primary',
                        ))}}
cynthia
  • 21
  • 1
0

Check out my previous answer.

Basicly laravel allows to decode any html with {{HTML::decode(<insert Form button here>) }}

Community
  • 1
  • 1
Net Lane
  • 16
  • 1
0

Unfortunately the form builder is always going to escape it's content. Furthermore, the submit input type only supports text content, not HTML. You need to use a button element to display HTML content.

<button class="btn btn-danger"><i class="fa fa-pencil"></i> Delete</button>
Dwight
  • 12,120
  • 6
  • 51
  • 64