使用按钮 type="submit" 而不是输入 - laravel

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25681983/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 10:02:44  来源:igfitidea点击:

using button type="submit" instead of input - laravel

phplaravellaravel-4font-awesomeblade

提问by sumit

I need to have font awesome image on button label. So i cannot use <input type="submit">

我需要在按钮标签上有字体真棒图像。所以我不能使用 <input type="submit">

<button type="submit" class="btn btn-success">
                <i class="fa-trash"></i> delete
</button>

View on laravel

在 Laravel 上查看

{{ Form::open(array('method' 
=> 'DELETE', 'route' => array('admin.states.destroy', $value->id))) }}                       
                            {{ Form::submit(HTML::decode(FA::icon('trash')), array('class'
 => 'actions-line icon-trash','onclick'=>'return confirm("Are you sure?")')) }}
                        {{ Form::close() }}

This is not rendering html inside button

这不是在按钮内呈现 html

What is the proper way?

什么是正确的方法?

回答by JofryHS

Something like

就像是

Form::button('<i class="fa fa-star"></i> Submit', array(
            'type' => 'submit',
            'class'=> 'actions-line icon-trash',
            'onclick'=>'return confirm("Are you sure?")'
    ));

Tailor to your taste. The only thing to note is that the type is set to submit

根据您的口味量身定制。唯一需要注意的是类型设置为submit