Avoid breaking error if validation error is for a widget that can't be found

This commit is contained in:
nathan 2024-10-09 09:38:48 -06:00
parent 0b29d723a4
commit 64ce874f62

View File

@ -1710,10 +1710,15 @@ export class etemplate2
(<et2_baseWidget>widget).showMessage(_response.data[id], 'validation_error'); (<et2_baseWidget>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]); 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 // Handle validation_error (messages coming back from server as a response) if widget is children of a tabbox
let tmpWidget = widget; let tmpWidget = widget;
while(tmpWidget.getParent() && tmpWidget.getType() !== 'ET2-TABBOX') while(tmpWidget.getParent() && tmpWidget.getType() !== 'ET2-TABBOX')