Is there a way to show / hide a sublist tab based ...
# suitescript
p
Is there a way to show / hide a sublist tab based on a value from a main line field?
s
Not with native suitescript, you could certainly use dom manipulation to hide the link to the tab which would make it to where the user cannot click on it/show it
How is the tab being added? If via code it would make more sense to only add the tab when desired rather than trying to hide later.
p
not via code. I thought of the dom manipulation way but my concern is that - in past experience - the div id tends to change and there is no rhyme or reason as to how that dim id is created (at least as far as I can tell).
l
if you’re using just one custom form, create a new one without this subtab and change it on beforeLoad based on your field
p
Thanks Luiz. I actually need the subtab to show / hide based on a field change event so that wouldn't work. The problem we are trying to solve is that there are too many subtabs and not enough screen space unless you start vertical scrolling - which we are trying to avoid. Will try the dom manipulation route and see how it goes. Worst case it doesn't hide if Netsuite updates that div id.
s
You could fool proof the dynamic tab naming system index by getting the tab off the page and loop the tab names. Like `let tabNames = $("#tb")[0].children[0].children[0].children`; This will be an array of the tabs, and you can check the
tabNames[i].textContent
to find your desired tab.
🙌 1
p
great idea!