Hide/Show Fields based on select box

karlab
Tera Contributor

Hello,

 

can someone please post what to do to hide or show the following fields based on 'technical governance intake path'

 

If NAS is selected it should show 

 

- validated cmdb accuracy (not sure why i cant edit this field)

- rationale

- technical architecture design

 

HIDE

- conceptual design

 

karlab_0-1727148605835.png

 

3 REPLIES 3

Pradeep Thipani
Mega Sage

Hello @karlab ,

 

You can achieve this using the Catalog client Script, you can reference the below script and adjust variables accordingly,

 

Create an onChange Client Script:

(function onChange(control, oldValue, newValue, isLoading) {
   if (isLoading || newValue == '') {
      return;
   }

   var intakePath = g_form.getValue('technical_governance_intake_path');
    
   // Show/Hide logic based on the 'NAS' selection
   if (intakePath === 'NAS') {
       g_form.setVisible('validated_cmdb_accuracy', true);
       g_form.setVisible('rationale', true);
       g_form.setVisible('technical_architecture_design', true);
       g_form.setVisible('conceptual_design', false);
   } else { //you can adjust the else condition according to your need
       // Hide fields when intake path is not 'NAS'
       g_form.setVisible('validated_cmdb_accuracy', false);
       g_form.setVisible('rationale', false);
       g_form.setVisible('technical_architecture_design', false);
       g_form.setVisible('conceptual_design', true);
   }
});

 

Please mark help and accept the solution if that helps.

 

Thanks,

Pradeep

"If this response was useful, please select 'Accept as Solution' and mark it as 'Helpful.' This helps me provide better answers and assists the community ".

Regards,
Pradeep

Not working

karlab
Tera Contributor

This is what I have on my script

karlab_0-1727454547211.png