v3.23.4: the event form's numeric option values (v3.22.0 regression)

esc() is string-only, and most EVENT_FORMS option values are numbers
({v:0,l:'Normal service'}, the ACCESSTECH list, ...): the shared event-form
renderer escaped them with esc(o.v), so opening any such event form threw
'str.replace is not a function' - in the Phone tab (pysimEventSendForm) and
the test-script step editor alike (both call the same builder).  Introduced
with v3.22.0, when the event action started using the Simulator's forms.

Option values (and the data-gr group) are stringified before escaping, the
pattern the sibling option builder already used; the emitted DOM values are
unchanged ("0", "10").

Test: event_forms.test.js renders every event form (Phone and step-editor
variants) and asserts a numeric option prefills selected - verified to fail
on the pre-fix code.  848 frontend + 830 Python; sw cache simple-v417.
This commit is contained in:
2026-10-07 13:44:31 +03:00
parent e8c991648d
commit cc335def00
5 changed files with 37 additions and 6 deletions
+3 -3
View File
@@ -1905,7 +1905,7 @@
// ===== Version =====
// Single source of truth for the PWA version: shown in the header and used
// by the server version check in pysimConnect().
const SIMPLE_VERSION = '3.23.3';
const SIMPLE_VERSION = '3.23.4';
document.getElementById('app-version').textContent = 'v' + SIMPLE_VERSION;
// ===== view history (the browser Back/Forward buttons) =====
@@ -16157,8 +16157,8 @@ function eventFormFieldsHtml(cfg, fields, values, prefix, withOnchange) {
html += '<select id="' + prefix + f.id + '"'
+ (withOnchange && f.onchange ? ' onchange="' + f.onchange + '"' : '')
+ ' class="w-full border border-gray-300 dark:border-slate-600 text-sm rounded px-2 py-1.5 dark:bg-slate-800">';
f.opts.forEach(o => html += '<option value="' + esc(o.v) + '"'
+ (o.g ? ' data-gr="' + esc(o.g) + '"' : '')
f.opts.forEach(o => html += '<option value="' + esc(String(o.v)) + '"'
+ (o.g ? ' data-gr="' + esc(String(o.g)) + '"' : '')
+ (v !== '' && String(o.v) === v ? ' selected' : '') + '>' + esc(o.l) + '</option>');
html += '</select>';
} else {