In Laravel, I want to show a form with checkboxes and their labels. I do it like this:
{{ Form::open(array('url'=>'fancyurl', 'method' => 'post')) }}
<p>Categories:</p>
<ul>
@foreach($categories as $c)
<li>
{{ Form::checkbox('categories[]', $c->id) }}
{{ Form::label('categories', $c->name) }}
</li>
@endforeach
</ul>
<p>
{{ Form::submit('Submit') }}
</p>
{{ Form::close() }}
It shows perfectly the checkboxes and their labels. But when I click on a label, the checkbox of the label is still unchecked. How can I set a "for"-attribute in Laravel?
Aucun commentaire:
Enregistrer un commentaire