Support Article
How to identify the active tab name in a tabbed layout
SA-21897
Summary
Selected tab must be available in Clipboard when switched between tabs in a Tabbed layout. An activity must be triggered using this property.
Error Messages
Not Applicable
Steps to Reproduce
1. Create a harness.
2. Add a tabbed container to it.
3. Add sections to each tab.
4. Check the clipboard to get the active tab name.
Root Cause
Not Applicable
Resolution
There is no option to find the selected Tab and to set it in clipboard. This is a requirement.
Include the code snippet given below in section containing tabs.
<script>
var eles = document.getElementsByTagName("li");
var i=0,count=0;
for(i;i<eles.length;i++ )
{
if(eles[i].hasAttribute("tabGroupName"))
{
var el=eles[i];
count++;
eles[i].onclick=function(){
var ev=this;
var tabSelected =this.title; // this could vary because if we are dirctly using Tab containers then the object will have textContent instead of title
var oSafeURL = new SafeURL("Gous-GCSWorkApp-Work.MyTestActivity");
oSafeURL.put("TestParam", tabSelected);
var strReturn = pega.util.Connect.asyncRequest('POST',oSafeURL.toURL(),'','');
};
eles[i].getAttribute("aria-selected").value=="true";
eles[i].onclick;
}
}
alert("no of tabs are "+count);
</script>
Published April 11, 2016 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.