Skip to content

Commit 4e529bf

Browse files
committed
Fix LovCombo dropping string selections under native RegExp.escape
Newer browsers (Chrome, Firefox 140+) ship a native RegExp.escape that throws a TypeError on non-String input. Ext.ux.form.LovCombo.setValue() previously passed JSON.stringify(value) to RegExp.escape to avoid that, but JSON.stringify() quotes string values, so they no longer matched the raw, unquoted output of getCheckedValue() and every selection in a string-valued combo (e.g. the WNPRC EHR Time of Day multi-select) was silently dropped. Use String() instead: it yields a valid String for RegExp.escape without quoting string values, fixing both the numeric-valueField crash and the string-valueField regression. LabKey/internal-issues#1266
1 parent 71205aa commit 4e529bf

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

core/webapp/Ext.ux.form.LovCombo.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,10 @@ Ext.ux.form.LovCombo = Ext.extend(Ext.form.ComboBox, {
293293
this.store.suspendEvents(true);
294294
this.store.clearFilter();
295295
this.store.each(function (r) {
296+
// Issue 7144: String() (not JSON.stringify) so native RegExp.escape doesn't throw on a
297+
// numeric valueField, while string values stay unquoted to match getCheckedValue() output.
296298
var checked = !(!v.match(
297-
'(^|' + this.separator + ')' + RegExp.escape(JSON.stringify(r.get(this.valueField)))
299+
'(^|' + this.separator + ')' + RegExp.escape(String(r.get(this.valueField)))
298300
+ '(' + this.separator + '|$)'));
299301
r.set(this.checkField, checked);
300302
}, this);

0 commit comments

Comments
 (0)