问题描述
我想知道是否有一种方法可以在 Laravel 3 .
I'd like to know if there is a way to customize the look of a submit button (to be an Image instead) in Laravel 3.
当前,我的提交"按钮代码如下:
Currently, my submit button code looks like this :
{{ Form::open('project/delete', 'DELETE') }}
{{ Form::hidden('id', $project->id) }}
{{ Form::submit('Delete project', array('class'=>'btn')); }}
{{ Form::close() }}
这正确地完成了他的工作.但是我看不到如何定制提交按钮并将其作为引导图标放置,例如使用;. <i class="icon-trash"></i>
And it's doing his job correctly. But I don't see how I could customize the submit button and put it as a bootstrap icon for example with ; <i class="icon-trash"></i>
我尝试使用:
{{ HTML::decode(HTML::link_to_route('project_delete', '<i class="icon-trash"></i>', array($project->id))); }}
但是,我的路由/函数调用遇到了问题.
But then I have a problem with my route/ function call.
推荐答案
您不能将HTML用作input
的值.如果您尝试<input type="submit" value='<i class="icon-trash"></i>'>
,您会发现它不起作用.此外,使用第二种方法之类的链接将不起作用,因为它实际上不会提交表单.
You can't use HTML for the value of an input
. If you tried <input type="submit" value='<i class="icon-trash"></i>'>
you would see it didn't work. Furthermore, using a link like your second approach won't work because it doesn't actually submit the form.
您最好的选择是使用一个按钮.
Your best bet would be to use a button.
<button type="submit"><i class="icon-trash"></i></button>
这篇关于Laravel图像提交按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!