When setting a validation error for a widget on a tab, switch to that tab so the user can see it.

This commit is contained in:
Nathan Gray 2013-07-08 21:55:38 +00:00
parent 5a6ed7c407
commit 54eb53cdba

View File

@ -187,6 +187,19 @@ var et2_inputWidget = et2_valueWidget.extend([et2_IInput,et2_ISubmitListener],
{
this.showMessage(_value, "validation_error");
$j(node).addClass("invalid");
// If on a tab, switch to that tab so user can see it
var widget = this;
var tab = this;
while(widget._parent && widget._type !='tabbox')
{
tab = widget;
widget = widget._parent;
}
if(!widget || typeof widget.setActiveTab == 'undefined') return;
var index = widget._children.indexOf(tab);
widget.setActiveTab(index);
console.log(widget);
}
}
},