If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Tab Solution - maintaining tab position when reprompting

Started by Stepharia, 18 May 2017 07:39:25 PM

Previous topic - Next topic

Stepharia

Posting this for anyone using the tab solution from Nimrod http://cognospaul.com/2013/12/22/tab-solution-thats-easy-maintain-without-code-guest-post/ who wants to be able to reprompt without it sending you back to the first tab.

I managed to modify the code from the solution to stay on the currently selected tab when reprompting by doing the following.
1. Create a textbox prompt at the very top of the page and name this TabPrompt in the properties.
2. Modify the code in the Function html item in the following areas:
Where the variables are being set up before "//theContent will contain all relevant divs" add 3 variables and an if statement as below:
var fW = (typeof getFormWarpRequest == "function" ? getFormWarpRequest() :
document.forms["formWarpRequest"]);   
var ti = 0;
var tabP = getFormWarpRequest()._textEditBoxTabPrompt.value;
if (!tabP) {
ti = 0;
}
else {
ti = Number(tabP);
}

In the section following "/*first tab is selected bu default*/" change as per below:
theHeaders[ti].style.cssText=selectedTab;
theHeaders[ti].tabID=ti;
theContent[ti].style.display="block";
for(var thi=0;thi<theHeaders.length;thi++){
if(thi!=ti){
theHeaders[thi].style.cssText=unselectedTab;

theHeaders[thi].tabID=thi;
theHeaders[thi].onclick=function(){clickTab(this.tabID);};
theHeaders[thi].onmouseover=function(){this.style.cssText=hoverTab;this.style.cursor="pointer";}
theHeaders[thi].onmouseout=function(){this.style.cssText=unselectedTab;this.style.cursor="default";}
}
else {
theHeaders[ti].style.cssText=selectedTab;
theHeaders[ti].tabID=ti;
}
}
for(var ci=0;ci<theContent.length;ci++){
if(ci!=ti){
theContent[ci].style.display="none";
}
else {
theContent[ci].style.display="block";
}
}


In the clickTab function add the following line of code after "//alert(id);"
fW._textEditBoxTabPrompt.value=id;

Once you've checked that this is all working correctly you should be able to set the visibility on your textbox prompt to No to keep it from appearing on the page.

Hope you find this helpful  :)