Unable to hide a field using UI Policy and Client script

Saridha_L1
Tera Expert

Hi Team,

I am not able to hide a mandatory field using UI Policy and Client script . I am using a below script,

function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if(newValue == 'Change default group'){
g_form.setMandatory('dl_location',false);
g_form.setDisplay('dl_location', false);
//document.getElementById("dl_location").style.display = "none";
g_form.setMandatory('unix_gp_name',false);
g_form.setDisplay('unix_gp_name', false);
}


else {

g_form.setMandatory('dl_location',true);
g_form.setDisplay('dl_location', true);
g_form.setMandatory('unix_gp_name',true);
g_form.setDisplay('unix_gp_name', true);


}
}
 Note: unix_gp_name is also a mandatory field, using the above script I am able to hide it. But I am not able to hide dl.location.

 

Please help.

 

Thank you.

Saridha.L

5 REPLIES 5

Not applicable

Hi Saridha,

  • The fields in a UI policy condition must be visible (even if hidden by UI policy or read-only) on the form for the condition to be tested.
  • The priority order for UI actions types is:
    1. Mandatory (highest)
    2. ReadOnly/Display

    If a Field is set to mandatory and does not have value, readonly or hide do not work on that Field. If a Field is hidden or readonly, and then set to mandatory, the field becomes visible or editable.

 

Mark If Helpful

Thank You