Skip to content

Commit bcb665d

Browse files
author
Dmitry Kuzin (DevExpress)
committed
1 parent 9ae1519 commit bcb665d

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/select2-tagbox.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,23 @@ function init(Survey, $) {
107107
.trigger("change");
108108
} else {
109109
$el.val(question.value).trigger("change");
110+
111+
if (
112+
question.allowAddNewTag &&
113+
$el.val().length !== question.value.length
114+
) {
115+
question.value.forEach(function (choiceValue) {
116+
if ($el.val().indexOf(choiceValue) === -1) {
117+
var newOption = new Option(
118+
choiceValue,
119+
choiceValue,
120+
true,
121+
true
122+
);
123+
$el.append(newOption).trigger("change");
124+
}
125+
});
126+
}
110127
}
111128
self.fixStyles(el);
112129
updateComment();

0 commit comments

Comments
 (0)