Important Update: Archer Community Scheduled Maintenance on November 23–24 - New Community Launching Soon! Learn More..
2019-01-17 11:22 AM
Wondering what the trick is, to get javascript in a custom object, to fire in a TabSet on a record? Is there some sort of event listener to leverage?
Using just a simple alert, like below, the alert only triggers if you are on the sub tab and toggle between view/edit. If you do not have the sub tab in focus, load the page, navigate to the sub tab, it does not fire.
<script>
alert('hello world');
</script>
Thanks in advance!
2019-01-17 11:34 AM
ALso, if you have on the section outside of a tab:
Sys.Application.add_load(function() {})
That part of a code will be executed every time your tab is loaded.
Which may help you to trigger the function inside the tab.
2019-01-17 11:38 AM
It's the way ASP.NET loads the tab contents that doesn't fire the script tags.
Using the function pageLoad({ //Code Here ]); in a custom object outside of the tab set will fire when the tabs are changed. You'd just have to determine which tab the user is on and execute the necessary code.
Something like this to determine which tab to execute code on:
<script type="text/javascript">
var fldId = 15349;
var tabIndex = 1;
function pageLoad() {
var layoutId = $CM._fields[fldId].layoutId;
var tabId = $LM._layoutItems[layoutId].tabId;
var tabSetId = $LM._tabs[tabId].tabSetId;
var tabStripElementId = 'master_DefaultContent_rts_ts' + tabSetId + '_t';
tabStrip = $find(tabStripElementId);
if (tabStrip._selectedIndex == tabIndex) {
//Code to execute
}
}
</script>
The tabIndex variable is which tab you want to execute the code on and the fldId variable is a way to get the tab set id.
Advisory Consultant
2019-01-17 12:43 PM