Hey, I've got troubles with my select2. When I write smth that can't be found in database by ajax and click on ' , ' (token separator) - it just writes it and trying to find it again with comma(I wanted to use separation and write another tag). How can i fix this? Thank you in advance. My view-code:
---
Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/59858397-yii2-select2-with-ajax-loading-and-token-separation-option?utm_campaign=plugin&utm_content=tracker%2F530581&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F530581&utm_medium=issues&utm_source=github).
Hey, I've got troubles with my select2. When I write smth that can't be found in database by ajax and click on ' , ' (token separator) - it just writes it and trying to find it again with comma(I wanted to use separation and write another tag). How can i fix this? Thank you in advance. My view-code:
<?=$form->field($model, 'tags')->widget(Select2::classname(), [ 'options' => [ 'multiple' => true, 'tags'=>true, 'tokenSeparators'=> [',', ' '], ], 'pluginOptions' => [ 'allowClear' => true, 'minimumInputLength' => 3, 'language' => [ 'errorLoading' => new JsExpression("function () { return 'Waiting for results...'; }"), ], 'ajax' => [ 'url' => $url, 'dataType' => 'json', 'data' => new JsExpression('function(params) { return {q:params.term}; }') ], 'escapeMarkup' => new JsExpression('function (markup) { return markup; }'), 'templateResult' => new JsExpression('function(city) { return city.text; }'), 'templateSelection' => new JsExpression('function (city) { return city.text; }'),