{!! Form::select(‘locationName[]’, $all_locations,[$locs_array],[‘class’ => ‘locationName form-control’,‘multiple’]); !!}
I tried this and it works fine with single values,multiple values are not getting set
{!! Form::select(‘locationName[]’, $all_locations,[$locs_array],[‘class’ => ‘locationName form-control’,‘multiple’]); !!}
I tried this and it works fine with single values,multiple values are not getting set
I’m not familiar with Laravel, but according the Select2 documentation on programmatically selecting items, in a multi-select Select2 you use jQuery (JavaScript) code like this:
$('#mySelect2').val(['1', '2']);
$('#mySelect2').trigger('change'); // Notify any JS components that the value changed
I understand that Laravel is a PHP framework. Select2 is a jQuery (JavaScript) UI widget. Does the code you pasted above generate JavaScript? If so, what does the generated JavaScript look like? In particular, I don’t see anything in your code that looks like it would trigger the “change” event.