jquery-select2

Select2: Can't create new options longer than 2 characters (tag: true)

a 夏天 提交于 2021-02-08 14:29:37
问题 I have a Select2 Box, with tagging enabled to add new own tags. Selecting an existing option works without any problem (of any length). But some code prevents me from adding a new option longer than 2 characters long (just can't add more characters). See the JSFiddle <select class="form-control select2" multiple="multiple" id="employee-groups-select" name="employee[employee_group_ids][]"> <option value="4">Text1</option> <option value="1">Text2</option> <option value="3">Text3</option>

Select2: Can't create new options longer than 2 characters (tag: true)

只谈情不闲聊 提交于 2021-02-08 14:29:08
问题 I have a Select2 Box, with tagging enabled to add new own tags. Selecting an existing option works without any problem (of any length). But some code prevents me from adding a new option longer than 2 characters long (just can't add more characters). See the JSFiddle <select class="form-control select2" multiple="multiple" id="employee-groups-select" name="employee[employee_group_ids][]"> <option value="4">Text1</option> <option value="1">Text2</option> <option value="3">Text3</option>

Select an option using python from select2 and fill web form

谁说胖子不能爱 提交于 2021-02-08 10:09:51
问题 I have this html code from select2 script: <div class='round10'> <select class='select2-authors-multiple' name='author[]' id='author' multiple style='width: 100%;'></select> and this from same page: <div class='round10'> <select class='select2-narrators-muliple' name='narrator[]' id='narrator' multiple='multiple' style='width: 100%;'></select> From firefox inspector i get this: <input class="select2-search__field" type="search" tabindex="0" autocomplete="off" autocorrect="off" autocapitalize=

How to use npm installed package in laravel application?

 ̄綄美尐妖づ 提交于 2021-02-07 09:32:42
问题 I want to use select2 package in my laravel 5 application. I installed it using npm install select2 and also ran npm run dev . It appears in my node_modules folder. But how do I actually refer to the files - js and scss of select2 package in my app.blade.php ? 回答1: Run npm run watch , because keeps track of all changes in .js . In app.js add require('select2/dist/js/select2'); In app.blade.php example: <div> <select class="js-select2 css-select2-50"> <option>1</option> </select> </div> 来源:

How to use npm installed package in laravel application?

跟風遠走 提交于 2021-02-07 09:31:06
问题 I want to use select2 package in my laravel 5 application. I installed it using npm install select2 and also ran npm run dev . It appears in my node_modules folder. But how do I actually refer to the files - js and scss of select2 package in my app.blade.php ? 回答1: Run npm run watch , because keeps track of all changes in .js . In app.js add require('select2/dist/js/select2'); In app.blade.php example: <div> <select class="js-select2 css-select2-50"> <option>1</option> </select> </div> 来源:

jquery Select2 prevent selecting in ajax response

懵懂的女人 提交于 2021-02-07 05:46:47
问题 I want to prevent from adding a category to the Select2 element if it fails creating the row first in my db. The action is not prevented when i call ev.preventDefault(); Nothing happens.. what is wrong? $('#sel2').select2({ placeholder: 'Enter categories', minimumInputLength: 3, multiple: true, ajax: { url: 'async/get_categories.php', dataType: 'json', quietMillis: 250, data: function (term, page) { return { q: term, }; }, results: function (data, page) { return { results: data.items }; },

Angularjs Custom select2 directive

穿精又带淫゛_ 提交于 2021-02-05 22:43:38
问题 I have created simple custom AngularJs directive for this awesome jquery plugin jQuery-Select2 as follows: Directive app.directive("select2",function($timeout,$parse){ return { restrict: 'AC', link: function(scope, element, attrs) { $timeout(function() { $(element).select2(); },200); } }; }); Usage in HTML templates: <select class="form-control" select2 name="country" data-ng-model="client.primary_address.country" ng-options="c.name as c.name for c in client.countries"> <option value=""

Select2 Css is not loading via yarn or assets precompile

坚强是说给别人听的谎言 提交于 2021-01-29 18:01:29
问题 I am running into a strange issue where everything is working as expected except select2. I am having Rails 6.0.0 app and installed select2 via yarn add select2 . Then i added it to application.js file. File looks like below. #app/javascripts/packs/application.js require("@rails/ujs").start() require("turbolinks").start() require("@rails/activestorage").start() require("channels") require('datatables.net') require('datatables.net-dt') require('datatables.net-bs4') require('select2') import

Styling `Select2` in line with `bootstrap4` and displaying error/success with `jQuery validation` [duplicate]

送分小仙女□ 提交于 2021-01-29 16:06:54
问题 This question already has answers here : Error placement, Select2 (2 answers) How to make select2 work with jquery.validation plugin? (15 answers) select2 and jquery validation not working properly (2 answers) Closed 9 months ago . Not duplicate This question should be reopened as previous questions (on this topic) with answers are 4-5 years old and refer to respective project's old versions. Not to mention that year in computing is like a 'light year' in real life. Please vote to reopen this

django_select2 - limit the returned text to a specific field in module

狂风中的少年 提交于 2021-01-29 14:39:09
问题 I am using django_select2 in my application. I would like to search and display only according to one field of a model. models.py: class Venue(models.Model): venue_name = models.CharField(max_length=50) venue_city = models.CharField(max_length=50) venue_country = models.CharField(max_length=50) def __str__(self): return f"{self.venue_name}, {self.venue_city}, {self.venue_country}" forms.py: from django import forms from .models import from django_select2 import forms as s2forms class