The CreatorCon Call for Content is officially open! Get started here.

Hide Tab/Section in client script

Mohamed Faizel
Giga Expert

Hi,

How to hide the form sections and tab using client script?

I   was trying the below client script with the reference of http://www.servicenowguru.com/scripting/client-scripts-scripting/showhide-form-section/

It was not working, hope it was working fine in Eureka   and we are in fuji now and it's not working in fuji, i tested in demo also, the below script not working

function onLoad() {

  //Hide the section

var section = $$('span[tab_caption_raw="Questions"]')[0].select('span[id*=section.]')[0];

section.hide();

  alert(section);

//Hide the tab

$$('.tab_caption_text').each(function(caption) {

      if(caption.innerHTML == 'Questions'){

              caption.up('.tab_header').hide();

      }

});

}

Could any one please help on this?

Thanks.

1 ACCEPTED SOLUTION

Mohamed Faizel
Giga Expert

I just tried the below script in Fuji, i can hide the section.


function onLoad() {  


var sections = g_form.getSections();  


sections[4].style.display = 'none';


}


Thanks.


View solution in original post

17 REPLIES 17

Mohamed Faizel
Giga Expert

I just tried the below script in Fuji, i can hide the section.


function onLoad() {  


var sections = g_form.getSections();  


sections[4].style.display = 'none';


}


Thanks.


Community Alums
Not applicable

Hi Faizeal,



I am using below code to hide the Section tab in RITM table. Which is working fine. But by using this method I am not able to get the menu list and Field dictionary information by right click.



g_form.setSectionDisplay('variables', false);



I also used   sections[2].style.display = 'none'; to hide the section. But facing the same issue.


Could you please let me know if   have you faced the problem and how did you fixed that.




Thanks,


Swamy


How many sections you have V V Ayyappaswamy Malluri ?


Community Alums
Not applicable

Hi Faizeal,




I am trying to hide one section. I found the issue. I was using wrong syntax on Client side script. Due to that I was getting unexpected behavior.



Thanks for your reply,


Swamy