1
I need to create a multi select on the page and am using the AdminLte
, the situation is as follows: A course can have several disciplines (the bank is ready with the right relationships)
<select class="js-example-basic-multiple" name="disciplinas[]" multiple="multiple">
@foreach($disciplinas as $disciplina)
<option value="{{ $disciplina->id_disciplina }}">{{ $disciplina->nome }}</option>
@endforeach
</select>
Just below I put Js
<script>
$('.js-example-basic-multiple').select2({
placeholder: 'Selecione as disciplinas',
allowClear: true
});
</script>
It loads as a textarea and does not mount select. It lists subjects in the Loop, but does not let you select more than one option.
I looked at it and it’s loading the CDNS:
cdnjs.cloudflare.com/ajax/libs/select2/4.0.10/js/select2.min.js
cdnjs.cloudflare.com/ajax/libs/select2/4.0.10/css/select2.min.css
My need is as follows: How to properly mount this multi select and how to send to the Controller to save the chosen options.
Where should I move this question?
– Junio Araujo