From f5ee48655a8e1e533dbafe7894ef4f254ee752b5 Mon Sep 17 00:00:00 2001 From: Awilum Date: Sat, 29 Feb 2020 11:20:51 +0300 Subject: [PATCH] feat(admin-plugin): add ability to work with string field for select2 --- .../admin/templates/partials/modules/select2.html | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/site/plugins/admin/templates/partials/modules/select2.html b/site/plugins/admin/templates/partials/modules/select2.html index 4f0fc4cc..817d6666 100644 --- a/site/plugins/admin/templates/partials/modules/select2.html +++ b/site/plugins/admin/templates/partials/modules/select2.html @@ -1,4 +1,11 @@ \ No newline at end of file + $('.js-tags').select2({tags: true, multiple: true, tokenSeparators: [',', ' ']}); + + $('.js-tags').on('change', function (e) { + $('.js-tags').each(function() { + var name = $(this).attr('data-name'); + $('input[name='+name+']').val($(this).val().toString()); + }); + }); +