I had tried it with and without the .value but the => eluded me. I have successfully used your code to dynamically rename the tab and have also applied the same logic to the second tab. Here is how it looks in my JS console.
//>>>>>>>>>>>>>> Populates the first tab with the Item ID value, concatenated to read "My Assignment #1"
fd.spRendered(() => {
var currentItemID = fd.itemId;
fd.container('HeaderTab').tabs[0].title = 'Item ID: ' + currentItemID;
});
//
//>>>>>>>>>>>>>> Populates the second tab with the inum value, concatenated to read "Item ID: 1"
fd.spRendered(() => {
var currentiNum = fd.field('inum').value;
fd.container('HeaderTab').tabs[1].title = 'My Assignment #' + currentiNum;
});
And here is what the end product looks like.
Compared to fd.spRendered(function() { can you educate me on exactly what this is doing? I get tripped up on the => and why it is needed.
fd.spRendered(() => {
Your knowledge and help is so appreciated, always.
Building the ability to dynamically add values to the tab names, I further enhanced a tab based on stakeholder feedback. The update added a longer string of text and required a small change to the CSS. I wanted to share it here in case anyone else runs into the same gotcha.
When the tab was active, the text fit perfectly, but the passive (not clicked) tab cut off the text. I added a min-width to the passive CSS and it worked as desired.
/* SECOND TAB, PASSIVE */.fd-form .tabset li:nth-child(2) a {min-width: max-content;
}
/* SECOND TAB, ACTIVE */.fd-form .tabset li:nth-child(2) a.active {background-color: #F6DA80 !important;color: black !important;