I am using laravel
5 and select2
dropdown for selecting various tags similar to stackoverflow tag field.
So once a number of tags are selected i want to retrieve them in the form of array and use it in laravel 5's controller to validate and store.
Also if user clicks edit post i want to add all the tags in the dropdown from the database
so user can easily make changes.
1) So mainly i want to know how can i retrieve data in form of array from select2
2) populate the select2
with data when user clicks edit How do i achieve these 2 functionality ?
<select multiple="multiple"
id="class_select"
class="form-control"
name="tag_select"
value=""
required
>
<option value="">PHP</option>
<option value="">C++</option>
</select>
<script>
$( document ).ready(function() {
$("#tag_select").select2();
$('#showbola').click(function(){
$("#tag_select").text();
});
});
</script>
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire