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

SD29
Tera Expert

Hi,

 

Is the field you are trying to Hide is a dictionary mandatory ? If yes, you need to change the field to be mandatory using a ui policy.

 

thanks,

SD

Hi ,

The variable is in Variable set, in variable set that field(location_made mandatory.

 

Regards,

Saridha.L

Upender Kumar
Mega Sage

Hi,

Please check if there is any UI policy exist for same field. UI policy is executed after client script.

 

 

Thanks

Shishir Srivast
Mega Sage

don't use both ways (client script and UI policy) to work on same field for same operation. Just verify the what others have suggested also hope you are doing this in catalog clients scripts/Catalog UI Policy?