|
|
|
@ -136,7 +136,17 @@ function createQuestionField( |
|
|
|
if (Array.isArray(value)) { |
|
|
|
option_id = value; |
|
|
|
} else if (typeof value === "string" && value) { |
|
|
|
const selectedOpt = question.options.find((opt) => opt.id === value || opt.value === value); |
|
|
|
const strVal = value.trim().toLowerCase(); |
|
|
|
const selectedOpt = question.options.find( |
|
|
|
(opt) => |
|
|
|
opt.id === value || |
|
|
|
opt.value === value || |
|
|
|
opt.label === value || |
|
|
|
opt.id.toLowerCase() === strVal || |
|
|
|
(typeof opt.value === "string" && opt.value.toLowerCase() === strVal) || |
|
|
|
(typeof opt.label === "string" && opt.label.toLowerCase() === strVal) || |
|
|
|
opt.id.toLowerCase().endsWith(`.${strVal}`) |
|
|
|
); |
|
|
|
option_id = selectedOpt ? selectedOpt.id : value; |
|
|
|
} |
|
|
|
} |
|
|
|
|