Laravel 刀片中标签标签中的单选按钮
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24522189/
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
Radio button in Label tag in Laravel blade
提问by rivai04
How to make this code into blade of laravel
怎么把这段代码做成laravel的blade
<label class="radio" for="penyakit-0">
<input name="penyakit" id="penyakit-0" value="Asma" type="radio">
Asma
</label>
i've tried many ways to the radio button can be clicked from its text by using blade syntax, but still don't get anything right..
我已经尝试了很多方法来使用刀片语法从其文本中单击单选按钮,但仍然没有得到任何正确的结果..
This is my blade syntax for that HTML:
这是该 HTML 的刀片语法:
<label class="radio" for="penyakit-0">
{{ Form::radio('penyakit', 'Asma', array('id'=>'penyakit-0')) }}
</label>
回答by menjaraz
Try:
尝试:
{{ Form::label('penyakit-0', 'Asma') }}
{{ Form::radio('penyakit', 'Asma', false, array('id'=>'penyakit-0')) }}
Edit:
编辑:
As Phil Gyfordpointed out above, this Laravel bladesnippet doesn't yield a label
element with an embedded input
element.
正如Phil Gyford上面指出的,这个 Laravel刀片片段不会产生label
带有嵌入input
元素的元素。
Unfortunately (or fortunately) by design design Laravel bladeopted for the alternate construction using for
attribute for some reason.
不幸的是(或幸运的是)Laravel Blade的设计设计for
出于某种原因选择了使用属性的替代结构。