Display variable sets only when the checkbox is checked

PriyaRaj
Tera Contributor

Hi, I am having when checkbox field "ack_check" in Service catalog. I need to hide all the variables of my variable set used and one other variable of catalog item when the checkbox is unchecked. And display them only when the checkbox is checked.

I tried achieving it with UI policy or (onLoad and onChange) catalog client script but it is working only for 3 variables not all.

Script: 

var check = g_form.getValue('ack_check');
if(check == 'false'){
g_form.setDisplay('end_usr_info_banner',false);
g_form.setDisplay('contact_number_other',false);
g_form.setDisplay('manager',false);
g_form.setDisplay('location',false);
g_form.setDisplay('type_of_request',false);
g_form.setDisplay('requested_by',false);
g_form.setDisplay('requested_for',false);
g_form.setDisplay('contact_number',false);
}
else if(check == 'true'){
g_form.setDisplay('end_usr_info_banner',true);
g_form.setDisplay('contact_number_other',true);
g_form.setDisplay('manager',true);
g_form.setDisplay('location',true);
g_form.setDisplay('type_of_request',true);
g_form.setDisplay('requested_by',true);
g_form.setDisplay('requested_for',true);
g_form.setDisplay('contact_number',true);
}

Let me know if anyone can help. Thanks in advance!!

1 REPLY 1

Muhammad Khan
Mega Sage
Mega Sage

Just make sure that the variables for which your implementation is not working are not mandatory. In case if they are mandatory, then first make them non-mandatory and then hide/show.