From 54eb53cdba73ac7d90c3434854b0db79dd9deb2e Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Mon, 8 Jul 2013 21:55:38 +0000 Subject: [PATCH] When setting a validation error for a widget on a tab, switch to that tab so the user can see it. --- etemplate/js/et2_core_inputWidget.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/etemplate/js/et2_core_inputWidget.js b/etemplate/js/et2_core_inputWidget.js index d746a569c6..632f201e79 100644 --- a/etemplate/js/et2_core_inputWidget.js +++ b/etemplate/js/et2_core_inputWidget.js @@ -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); } } },