Skip to content

Commit 7899bd8

Browse files
author
T_S_V
committed
Fixed #233 - select2 keeps incorrect value instead of removing it
1 parent 435743f commit 7899bd8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/select2.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ function init(Survey, $) {
7676
var updateValueHandler = function () {
7777
if (isSettingValue) return;
7878
isSettingValue = true;
79-
if ($el.find("option[value='" + question.value + "']").length) {
79+
if ($el.find("option[value='" + (question.value || "") + "']").length) {
8080
$el.val(question.value).trigger("change");
8181
} else {
8282
if (question.value !== null && question.value !== undefined) {
@@ -118,6 +118,7 @@ function init(Survey, $) {
118118
};
119119
})
120120
);
121+
question.clearIncorrectValues();
121122
$el.select2(settings);
122123
}
123124
// fixed width accrording to https://stackoverflow.com/questions/45276778/select2-not-responsive-width-larger-than-container

0 commit comments

Comments
 (0)