Hello,
I would like my tab name to change accordingly when I select a value in a dropdown.
It works with this code, but I would like to make it more efficient.
This is the working code:
function changeTab(){
if(fd.field('Selection_x0020_of_x0020_Busines').value == 'Customer SD'){
fd.container('Tab1').tabs[1].title = 'Customer SD'
} else if(fd.field('Selection_x0020_of_x0020_Busines').value == 'Vendor'){
fd.container('Tab1').tabs[1].title = 'Vendor'
} else if(fd.field('Selection_x0020_of_x0020_Busines').value == 'Ship-to'){
fd.container('Tab1').tabs[1].title = 'Ship-to'
} else if(fd.field('Selection_x0020_of_x0020_Busines').value == 'Debtor FI'){
fd.container('Tab1').tabs[1].title = 'Debtor FI'
} else if(fd.field('Selection_x0020_of_x0020_Busines').value == 'Architects, planer'){
fd.container('Tab1').tabs[1].title = 'Architects, planer'
} else if(fd.field('Selection_x0020_of_x0020_Busines').value == 'Competitor'){
fd.container('Tab1').tabs[1].title = 'Competitor'
} else if(fd.field('Selection_x0020_of_x0020_Busines').value == 'Prospect'){
fd.container('Tab1').tabs[1].title = 'Prospect'
} else if(fd.field('Selection_x0020_of_x0020_Busines').value == 'Other BP'){
fd.container('Tab1').tabs[1].title = 'Other BP'
} else {
fd.container('Tab1').tabs[1].title = ''
}
}
fd.field('Selection_x0020_of_x0020_Busines').$on('change',changeTab);
changeTab();
This the new one. Could you tell me how to modify the code accordingly so that it does what the top one does?
function changeTab(){
var i =0;
for (i=0; i < fields.length; i =i+1){
if(fd.field('Selection_x0020_of_x0020_Busines').value == fields[i]){
fd.container('Tab1').tabs[1].title = fields[i]
} else {
fd.container('Tab1').tabs[1].title = ''
}
}
}
Thank you and best regards