Hello everyone,
I have an application that uses PHP in the back and the Js on the front along with HTML and CSS (the basics).
And I have a problem with using the selectize for editing a form that makes use of it.
The situation is as follows:
A select with all the permissions of possible users, but in that same form has a variable with the permissions that the user already has, my problem is to already insert these variables as already selected, is loading as a normal select coming only the first item selected, being that Js I just load at the end of HTML and initialize the selectize in my select.
what would be the correct way to implement a select with pre-selected values?
Just make the options like you would a regular select box?
Do you say put the "selected" attribute in the
<select id="select-name" placeholder="Select a person..." multiple>
<option value="997" SELECTED>Some Already selected option</option>
<!-- INSERT REST OF OPTIONS HERE -->
</select>
$(function() {
$('#select-name').selectize();
});
The place I'm filling is this way:
(attached)

And my JS
`$(document).ready(function() {
Materialize.updateTextFields();
$('#roles').selectize({
maxItems: 15
});
});`
I can help if you paste the code, but I can't copy and paste from a screenshot.
closing stale issues older than one year.
If this issue was closed in error please message the maintainers.
All issues must include a proper title, description, and examples.
Most helpful comment
I can help if you paste the code, but I can't copy and paste from a screenshot.