Hide containers based on choice options

sailesh1
Tera Contributor

HI,

Is there anyway to hide the containers based on the choice option selected.

I know it would work using UI policy, but I also tried the same via Catalog client script ('on change'), which didn't help.

Can anyone of you help me out?

#Snippet I used

function onChange(control, oldValue, newValue, isLoading) {
   if (isLoading || newValue == '') {
      return;
   }
    
 var num=g_form.getValue('firewall_no_of_rules');
    if(num==2)
        {
            
            g_form.setVisible('firewall_rules2',true);
        }
    else if(num==3)
        {
            g_form.setVisible('firewall_rules3',true);
        }

Thanks

Sailesh

1 ACCEPTED SOLUTION

BigMikeyVegas
Tera Guru

Did you ever find an answer for this? I am trying something similar.

 

I am using this code, and it is not working...

function onLoad() {

	var Type = g_form.getValue('variables.BI_ReqType');

   alert(Type);

         if (Type !== 'Modify Report Distribution')
                try {
                      $("container_31646219dbf317405b9add0b5e9619bc").hide();
                  } catch(error) {}
	
         if (Type !== 'Create Report')
                try {
                      $("container_12f46a19dbf317405b9add0b5e96191e").hide();					   
                   } catch(error) {}
 
         if (Type !== 'Modify Report')
               try {
                       $("container_1a53aa95dbf317405b9add0b5e9619a1").hide();
                   } catch(error) {}
 
         if (Type !== 'Schedule Report')
               try {
                      $("container_fb46ee19dbf317405b9add0b5e96198d").hide();
                   } catch(error) {}
 
         if (Type !== 'Publish Report')
                try {
                       $("container_08196e99dbf317405b9add0b5e961982").hide();			   
				   } catch(error) {}

         if (Type !== 'New Data Request')
                  try {
                       $("container_5d41fe11db3717405b9add0b5e961951").hide();
                   } catch(error) {}

         if (Type !== 'Data/Report Question')
                  try {
                       $("container_0c42b611db3717405b9add0b5e96197d").hide();
                  } catch(error) {}
   }

View solution in original post

7 REPLIES 7

Hi Rajashekhar,

I'm using Jakarta and know that it wouldn't work out (although I didn't have any mandatory variables inside it)

Hence going for a client script.

Any other suggestion for this is welcome 🙂

 

BigMikeyVegas
Tera Guru

Did you ever find an answer for this? I am trying something similar.

 

I am using this code, and it is not working...

function onLoad() {

	var Type = g_form.getValue('variables.BI_ReqType');

   alert(Type);

         if (Type !== 'Modify Report Distribution')
                try {
                      $("container_31646219dbf317405b9add0b5e9619bc").hide();
                  } catch(error) {}
	
         if (Type !== 'Create Report')
                try {
                      $("container_12f46a19dbf317405b9add0b5e96191e").hide();					   
                   } catch(error) {}
 
         if (Type !== 'Modify Report')
               try {
                       $("container_1a53aa95dbf317405b9add0b5e9619a1").hide();
                   } catch(error) {}
 
         if (Type !== 'Schedule Report')
               try {
                      $("container_fb46ee19dbf317405b9add0b5e96198d").hide();
                   } catch(error) {}
 
         if (Type !== 'Publish Report')
                try {
                       $("container_08196e99dbf317405b9add0b5e961982").hide();			   
				   } catch(error) {}

         if (Type !== 'New Data Request')
                  try {
                       $("container_5d41fe11db3717405b9add0b5e961951").hide();
                   } catch(error) {}

         if (Type !== 'Data/Report Question')
                  try {
                       $("container_0c42b611db3717405b9add0b5e96197d").hide();
                  } catch(error) {}
   }

BigMikeyVegas
Tera Guru

Also, if you remove the

   alert(Type);

 

you will not receive the pop up each time the containers collapse.