- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2019 08:46 AM
On our change form, we are adding a tab specifically for application type change requests (as opposed to our infrastructure changes). We would like to have this tab be hidden unless someone chooses "Application" in the 'Class' field:
I tried using the instructions from this blog post, but the Application tab is still showing no matter what is chosen in the Class field. Below is the script I have:
Pasted as text:
[To show the tab when "Application" is chosen]
function onCondition() {
g_form.setSectionDisplay('application', false);
//Show the section
var section = $$('span[tab_caption_raw="Application"]')[0].select('span[id*=section.]')[0];
section.show();
//Show the tab
$$('.tab_caption_text').each(function(caption) {
if(caption.innerHTML == 'Application'){
caption.up('.tab_header').show();
}
});}
[To hide the tab when "Application" is not chosen]
function onCondition() {
g_form.setSectionDisplay('application', false);
//Hide the section
var section = $$('span[tab_caption_raw="Application"]')[0].select('span[id*=section.]')[0];
section.hide();
//Hide the tab
$$('.tab_caption_text').each(function(caption) {
if(caption.innerHTML == 'Application'){
caption.up('.tab_header').hide();
}
});
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2019 12:04 PM
Lets start with minimum code in both true and false code blocks
Make sure active=true, reverse if false = true
for the true code block use
function onCondition() {
g_form.setSectionDisplay('application', false);
/*
//Show the section
var section = $$('span[tab_caption_raw="Application"]')[0].select('span[id*=section.]')[0];
section.show();
//Show the tab
$$('.tab_caption_text').each(function(caption) {
if (caption.innerHTML == 'Application') {
caption.up('.tab_header').show();
}
});
*/
}
for false code block use
function onCondition() {
g_form.setSectionDisplay('application', true);
/*
//Hide the section
var section = $$('span[tab_caption_raw="Application"]')[0].select('span[id*=section.]')[0];
section.hide();
//Hide the tab
$$('.tab_caption_text').each(function(caption) {
if (caption.innerHTML == 'Application') {
caption.up('.tab_header').hide();
}
});
*/
}
Vinod Kumar Kachineni
Community Rising Star 2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-15-2023 08:34 AM
Hello Vinod ,
In above scrip which application is referring to class value "Application and the Tab Name "Application"
g_form.setSectionDisplay('application', false); ---> Is this the class field choice value or the Tab name
same for below two
var section = $$('span[tab_caption_raw="Application"]')[0].select('span[id*=section.]')[0];
if (caption.innerHTML == 'Application'
Thanks in advance.
Amit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-16-2023 09:18 AM
Tab names.
g_form.setSectionDisplay takes the tab names.
To get section names on a form use
var sections = g_form.getSectionNames();
console.log(sections.toString());
Vinod Kumar Kachineni
Community Rising Star 2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2019 10:04 AM
See if the section names are correct
Add the code in both true/false
get a list
var sections = g_form.getSectionNames();
alert(sections.toString());
//Tested this on PDI
if category is hardware do not show tab conflicts
function onCondition() {
g_form.setSectionDisplay('conflicts', false); //or true depending on the condition should work
}
Vinod Kumar Kachineni
Community Rising Star 2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2019 10:27 AM
Thank you for your response vkachineni. Are you saying I should try using these scripts? Sorry I'm not sure what you exactly mean here. If you could provide some clarification, that would be helpful - as you can see I'm not very experienced with this stuff.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2019 11:37 AM
I have tested this code on incident
if category is hardware do not show tab conflicts
function onCondition() {
g_form.setSectionDisplay('conflicts', false); //or true depending on the condition should work
}
Vinod Kumar Kachineni
Community Rising Star 2022