Home » Php » php – Radio button in Label tag in Laravel blade

php – Radio button in Label tag in Laravel blade

Posted by: admin July 12, 2020 Leave a comment


How to make this code into blade of laravel

<label class="radio" for="penyakit-0">
    <input name="penyakit" id="penyakit-0" value="Asma" type="radio">

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:

<label class="radio" for="penyakit-0">
    {{ Form::radio('penyakit', 'Asma', array('id'=>'penyakit-0')) }} 
How to&Answers:


{{ Form::label('penyakit-0', 'Asma') }}
{{ Form::radio('penyakit', 'Asma', false, array('id'=>'penyakit-0')) }}


As Phil Gyford pointed out above, this Laravel snippet doesn’t yield a label element with an embedded input element.

Unfortunately (or fortunately) by design design Laravel opted for the alternate construction using for attribute for some reason.