Fix webcomponents with validation errors did not get tab activated

This commit is contained in:
nathan 2022-07-14 11:37:29 -06:00
parent fb423b4efc
commit 3c96eb9ce6

View File

@ -1561,22 +1561,22 @@ export class etemplate2
{ {
(<et2_baseWidget>widget).showMessage(_response.data[id], 'validation_error'); (<et2_baseWidget>widget).showMessage(_response.data[id], 'validation_error');
// 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() != 'tabbox')
{
tmpWidget = tmpWidget.getParent();
}
//Acvtivate the tab where the widget with validation error is located
if(tmpWidget.getType() == 'tabbox')
{
(<et2_tabbox><unknown>tmpWidget).activateTab(widget);
}
} }
else if(typeof widget.set_validation_error == "function") else if(typeof widget.set_validation_error == "function")
{ {
widget.set_validation_error(_response.data[id]); widget.set_validation_error(_response.data[id]);
} }
// 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() != 'tabbox')
{
tmpWidget = tmpWidget.getParent();
}
//Acvtivate the tab where the widget with validation error is located
if(tmpWidget.getType() == 'tabbox')
{
(<et2_tabbox><unknown>tmpWidget).activateTab(widget);
}
} }
egw().debug("warn", "Validation errors", _response.data); egw().debug("warn", "Validation errors", _response.data);
} }