This topic is locked
[SOLVED]

 Current Where Tab ID

8/12/2020 3:04:18 PM
ASPRunner.NET General questions
I
i.NoLim author

I'm attempting to use the "Additional Where Tabs" functionality but I would like to control what's displayed depending on the tab selected. For example, I would like to show the "Add new" button only if the "Where Tab ID" == 0 and hide it otherwise or show/hide fields if the "Where Tab ID" != 0.
My main question is how do I obtain the active tab? I tried the following but I guess this only works for tabs made in Designer?



var tabs = pageObj.getTabs();

var idx = tabs.activeIdx()
var id = "addButton";

var button = $("[id^=" + id + "]");

if (idx != 0){

button.hide();

}




var tabs = pageObj.getTabs();

var idx = WhereTabs.activeIdx()
var id = "addButton";

var button = $("[id^=" + id + "]");

if (idx != 0){

button.hide();

}
I
i.NoLim author 8/12/2020

I found the solution here.
Working code.



var activetab = $("li[class=active]").find("a").attr("data-tabid")
var id = "addButton";

var button = $("[id^=" + id + "]");

if (activetab != 0){

button.hide();

}
I
i.NoLim author 8/12/2020

Is there any way to control the Label of a field based on the active tab? I found in the manual the setFieldLabel method but this can only be used in the AfterAppInit, AfterTableInit, or BeforeProcess events. How do I pass the value I got from the JavaScript Onload event?
The reason why I would like to do this is because I currently have 3 columns (dateUpdated, dateClosed, dateDeleted) that I would like to combine into one, dateUpdated, but I would still like the label to appear as 'Date Updated' 'Date Closed' and 'Date Deleted' in their respective tabs.