From af3d744585ddfb3c3c8aa4bd5e75146588273078 Mon Sep 17 00:00:00 2001 From: D-Groenewegen Date: Tue, 15 Jul 2025 22:46:43 +0200 Subject: [PATCH 1/3] Update wsInstance.js: fix for apostrophes in values If a value contains an apostrophe, the current implementation fails with 'Syntax error, unrecognized expression'. This fix prevents the issue by using double quotes around the value. I don't think we need to cater for double quotes in values, at least not if the values are returned by the API in the JSON format. If I'm mistaken though and there are exceptions, then something like this should work: ``` let optionSelected = $(select).find('option[value="' + values[i].replaceAll('"', '\\"') + '"]') ``` --- Modules/instances/wsInstance.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/instances/wsInstance.js b/Modules/instances/wsInstance.js index 1eb05823..20734874 100644 --- a/Modules/instances/wsInstance.js +++ b/Modules/instances/wsInstance.js @@ -164,7 +164,7 @@ const WsInstance = function (selector, options) { } } } else { - let optionSelected = $(select).find('option[value=\'' + values[i] + '\']') + let optionSelected = $(select).find('option[value="' + values[i] + '"]') if (optionSelected.length > 0 && values[i] !== '') { optionSelected.prop('selected', 'selected') } else if (optionSelected.length === 0 && $(select).data('inputtype') !== 'ws-select2') { From 0049c8787af9a680883dca3cc8acdb663267e33b Mon Sep 17 00:00:00 2001 From: D-Groenewegen Date: Tue, 16 Dec 2025 16:19:27 +0100 Subject: [PATCH 2/3] Fix option selection logic in wsInstance.js Per suggestion --- Modules/instances/wsInstance.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/instances/wsInstance.js b/Modules/instances/wsInstance.js index 20734874..f76476eb 100644 --- a/Modules/instances/wsInstance.js +++ b/Modules/instances/wsInstance.js @@ -164,7 +164,7 @@ const WsInstance = function (selector, options) { } } } else { - let optionSelected = $(select).find('option[value="' + values[i] + '"]') + let optionSelected = $(select).find('option[value=\'' + values[i].replace("'", "\\\'") + '\']') if (optionSelected.length > 0 && values[i] !== '') { optionSelected.prop('selected', 'selected') } else if (optionSelected.length === 0 && $(select).data('inputtype') !== 'ws-select2') { From c1bbc6ebced6e41dd7b85841fe14996510601de6 Mon Sep 17 00:00:00 2001 From: D-Groenewegen Date: Tue, 16 Dec 2025 16:22:08 +0100 Subject: [PATCH 3/3] replaceAll not replace --- Modules/instances/wsInstance.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/instances/wsInstance.js b/Modules/instances/wsInstance.js index f76476eb..fd299d9f 100644 --- a/Modules/instances/wsInstance.js +++ b/Modules/instances/wsInstance.js @@ -164,7 +164,7 @@ const WsInstance = function (selector, options) { } } } else { - let optionSelected = $(select).find('option[value=\'' + values[i].replace("'", "\\\'") + '\']') + let optionSelected = $(select).find('option[value=\'' + values[i].replaceAll("'", "\\\'") + '\']') if (optionSelected.length > 0 && values[i] !== '') { optionSelected.prop('selected', 'selected') } else if (optionSelected.length === 0 && $(select).data('inputtype') !== 'ws-select2') {