Category : jquery-select2

I’ve created a function that returns a json of products data, and I’ve wanted to display it in select2 in an infinite scroll way. Right now, I can only display according to the number of paginated results. Here’s my controller: <?php namespace AppHttpControllers; use IlluminateHttpRequest; use IlluminateSupportStr; use AppModelsProduct; class ReceiveInventoryController extends Controller { public ..

Read more

I have a select2 in a livewire component. Everything works fine but in my edit view, the selected options don’t show in the box is selected. When I open the dropdown they show as highlighted, so data is coming from the backend. Please check below codes and output screenshots, Thanks in advance for your kind ..

Read more

I have an array called a catalog that has a relationship with several stores. I get them with this command on controller. There are users they also have relationship with several stores. $stores = $user->store()->get(); $catalog = $user->catalog()->with(‘store’)->get(); return view(‘manager.catalogs.manage’, compact(‘stores’, ‘catalog’)); I want to make selection using select2 with multiple option. <select class="select2 form-control ..

Read more

I’m working on a B2B ordering app and was using simple select/dropdowns to provide products to order and adding additional lines with jquery as needed – all working perfectly. I’ve now changed the select to select2 to provide searching. The first item works correctly, but if you add an additional line, it provides the select2 ..

Read more

I inserted the select2 value in the database using multi-select drop down, but when I edit the modal it returns no value in the selected value. I am using jquery ajax with Laravel. Form <form id="userForm" name="userForm" class="form-horizontal" data-parsley-validate=""> <input type="hidden" name="user_id" id="user_id"> <div class="form-group"> <label for="email" class="col-sm-2 control-label">Project</label> <div class="col-sm-12"> <select id="project_id" name="project_id[]" class="selectpicker ..

Read more

I am building a CRM project with Laravel 8. I want to use select2 but there is something wrong. I can’t select after first select. It looks like this and I can’t select. HTML: <div class="form-row"> <div class="col-md-12"> <div class="position-relative "> <label for="gondericiAdi">Göndericinin Adı:</label> </div> <div class="input-group"> <select class="form-control" name="" style="width:100%;" id="gondericiAdi"> </select> </div> </div> ..

Read more

I am trying to add the default selected option to multiple select2 with remote data. But the title is set instead of the option text. This is my code: Html <select class="form-control select_medicines" id="select_medicines" name="medicines[]" multiple="multiple"> @foreach($medicines as $medicine) <option value="{{$medicine->id}}" selected="selected">{{$medicine->fa_name . "(" . $medicine->en_name . ")"}}</option> @endforeach </select> Js $(document).ready(function() { $(".select_medicines").select2({ ajax: ..

Read more

I am using Livewire and Slect2 in my project and I am code to select 2 javascript also but select 2 value is not passed to the database here is my code My Blade File <div class="col-12 col-lg-12 col-sm-12"> <div wire:ignore> <div class="form-group"> <label for="exampleInputRounded0">Section Name</label> <div class="input-group"> <div class="input-group-prepend"> <span class="input-group-text"><i class="fas fa-globe-asia text-primary"></i></span> ..

Read more

I’m working with Laravel 8 and for the screen tests I’m using Dusk (https://laravel.com/docs/8.x/dusk). In one of the screens, i have a select2 with "tags" property enabled (https://select2.org/tagging), that allows you to create a new record if there is no option in select. I just cant the test "Create a new option for select2 with ..

Read more

I write HTML code in controller public function edit($id) { $user = User::find($id); $rolesForEdit = Role::pluck(‘name’, ‘name’)->all(); $userRole = $user->roles->pluck(‘name’, ‘name’)->all(); $html = ‘<div class="row"> <div class="col-md-6"> <label for="name">Name</label> <input value="’ . $user->name . ‘" class="form-control" placeholder="Full Name" type="text" name="name" id="name" /> <br> <label for="phone">Phone Number</label> <input value="’ . $user->phone . ‘" class="form-control" placeholder="Phone Number" ..

Read more

I am using select2 options for multiple city and location and i am trying to get city_id when i click to location option on click but not getting city_id please help me how can i resolve that thanks. getting error https://ibb.co/jzxRQwF html view <div class="col-md-6"> <div class="form-group"> <label>City</label> <select name="city[]" class="city form-control select2" required data-parsley-errors-container="#error-agency" ..

Read more

I have a select2 in a livewire component. Everything works fine but in my edit view, the selected options dont show in the box as selected. When I open the dropdown they show as highlighted, so data is coming from backend. <div wire:ignore class="col-8"> <select wire:model="notificationType" class="form-control select2 text-sm" multiple="multiple"> @foreach($notificationTypeOptions as $key => $option) ..

Read more

I’m using select2 plugin in Laravel form: <select id="productTags" class="form-control mt-2 select2-hidden-accessible" tabindex="-1" multiple="multiple" name="productTags" data-select2-id="productTags"> <option value="adidas">adidas</option> <option value="asics-tiger" data-select2-id="7">asics-tiger</option> <option value="autumn" data-select2-id="8">autumn</option> <option value="backpack">backpack</option> <option value="cap">cap</option> <option value="converse">converse</option> <option value="drmartens">drmartens</option> </select> <select id="productVendors" class="form-control mt-2 select2-hidden-accessible" tabindex="-1" multiple="multiple" name="productVendors" data-select2-id="productVendors"> <option value="ADIDAS">ADIDAS</option> <option value="ASICS TIGER">ASICS TIGER</option> <option value="CONVERSE">CONVERSE</option> <option value="DR MARTENS" data-select2-id="12">DR MARTENS</option> ..

Read more

I am currently using select2 with a Laravel project like this: Html: <div class="row"> <select class="offices" name="offices"></select> </div> JS: $(".offices").select2({ ajax: { url: "{{route(‘site.addresses’)}}", type: "post", dataType: ‘json’, data: function (params) { return { _token: @json(csrf_token()), searchTerm: params.term }; }, processResults: function (response) { return { results: response }; }, cache: true } }); How ..

Read more