Fix multi option select handling of default value being hardcoded to a string

This commit is contained in:
Andrew Kingston 2020-11-03 10:09:22 +00:00
parent c9cc3d5aba
commit 0634d2fa5f
1 changed files with 4 additions and 0 deletions

View File

@ -11,6 +11,10 @@
$: sanitiseOptions(options)
function getValidOptions(selectedOptions, allOptions) {
// Fix the hardcoded default string value
if (!Array.isArray(selectedOptions)) {
selectedOptions = []
}
return selectedOptions.filter(val => allOptions.indexOf(val) !== -1)
}