From 64ce874f627fd36e6ff386a526d7169ceedba461 Mon Sep 17 00:00:00 2001 From: nathan Date: Wed, 9 Oct 2024 09:38:48 -0600 Subject: [PATCH] Avoid breaking error if validation error is for a widget that can't be found --- api/js/etemplate/etemplate2.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/api/js/etemplate/etemplate2.ts b/api/js/etemplate/etemplate2.ts index cb764b7a00..dfbdd4aed6 100644 --- a/api/js/etemplate/etemplate2.ts +++ b/api/js/etemplate/etemplate2.ts @@ -1710,10 +1710,15 @@ export class etemplate2 (widget).showMessage(_response.data[id], 'validation_error'); } - else if(typeof widget.set_validation_error == "function") + else if(widget && typeof widget.set_validation_error == "function") { widget.set_validation_error(_response.data[id]); } + else if(!widget) + { + console.warn(`Validation error without widget. ID:${id} - ${_response.data[id]}`); + continue; + } // Handle validation_error (messages coming back from server as a response) if widget is children of a tabbox let tmpWidget = widget; while(tmpWidget.getParent() && tmpWidget.getType() !== 'ET2-TABBOX')