【发布时间】:2014-08-13 05:05:24
【问题描述】:
有没有办法使用Form::label 与复选框和单选输入来生成bootstrap 建议的标记?目的是在标签内添加输入字段,而不是使用ids 附加它们。我想避免对Form::radio周围的标记进行硬编码
<div class="checkbox">
<label>
<input type="checkbox" value="">
Option one is this and that—be sure to include why it's great
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="optionsRadios" id="optionsRadios1" value="option1" checked>
Option one is this and that—be sure to include why it's great
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="optionsRadios" id="optionsRadios2" value="option2">
Option two can be something else and selecting it will deselect option one
</label>
</div>
【问题讨论】:
-
您需要扩展
Form类并编写您的自定义input实现。幸运的是捆绑实现已经存在:bundles.laravel.com/search/tag/Bootstrap (bootsparks, bootstrapper) -
我试图弄清楚如何扩展 Form 类。结果我宁愿选择
<label>{{ Form::radio(...) }} Radio Label</label>:D
标签: html twitter-bootstrap laravel