- 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
‎06-28-2019 09:02 AM
This line should work
g_form.setSectionDisplay('application', false);
Can you share the rest of the conditions for the UI Policy, or try running in an onChange client script for the class field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2019 10:25 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2019 10:35 AM
2 things stand out, 1 is it is active = false, hopefully you had active during testing, and that reverse if false is false as well, meaning your if false script will not execute, and your if true script is showing the section so you would never see it disappear.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2019 10:46 AM
Thanks for pointing that out, I completely missed that I changed that. So now that both of those are active, my tab is hidden when Class is set to infrastructure, however when I change it to Application, I get this error message:
Additionally, I tested it on a blank submit change form, and the tab does show as a default. Is an additional script required to make the default setting not show the tab unless a user changes the class to application?