Home Forums Porto Admin Template Select2

This topic contains 1 reply, has 2 voices, and was last updated by  Support2 8 months, 1 week ago. This post has been viewed 243 times

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #10027570


    Hi. I use select2 plugin in option multiple. From the list of available items I would like to select the default several values ​​that will be retrieved from the database. How could I solve this?




    You must return the select options from database with the selected attribute. For example:

    <select multiple data-plugin-selectTwo class="form-control populate" lang="es">
    	<optgroup label="Alaskan/Hawaiian Time Zone">
    		<option value="AK" selected>Alaska</option>
    		<option value="HI" selected>Hawaii</option>
    	<optgroup label="Pacific Time Zone">
    		<option value="CA">California</option>
    		<option value="NV">Nevada</option>
    		<option value="OR" selected>Oregon</option>
    		<option value="WA">Washington</option>
    	<optgroup label="Mountain Time Zone">
    		<option value="AZ">Arizona</option>
    		<option value="CO">Colorado</option>
    		<option value="ID">Idaho</option>
    		<option value="MT">Montana</option>
    		<option value="NE">Nebraska</option>
    		<option value="NM">New Mexico</option>
    		<option value="ND">North Dakota</option>
    		<option value="UT">Utah</option>
    		<option value="WY">Wyoming</option>

    * Note the selected.

    Please, try that and let us know if you need further assistance.

    Kind Regards,


Viewing 2 posts - 1 through 2 (of 2 total)