I have a form in which the user should at least select one of the check boxes. This is the code for generating a group of check boxes in the view:
<div class="form-group">
@foreach($subjects as $subject)
<label>{!! Form::checkbox('subject[]', $i++, null, ['id' => 'subject']) !!} {!! $subject !!} </label>
@if($i%10==0)
{!! "<br />" !!}
@endif
@endforeach
</div>
For now if the user does not select a subject the subject index will not set so there will be nothing to be validated. How can I validate that the user has selected at least one subject?
Aucun commentaire:
Enregistrer un commentaire