Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Radio button in Label tag in Laravel blade

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">
    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:

<label class="radio" for="penyakit-0">
    {{ Form::radio('penyakit', 'Asma', array('id'=>'penyakit-0')) }} 
</label>
like image 793
rivai04 Avatar asked Jul 02 '14 02:07

rivai04


1 Answers

Try:

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

Edit:

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

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

like image 171
menjaraz Avatar answered Oct 22 '22 14:10

menjaraz