UI policy

Akshaya14
Tera Contributor

Hi Team,

I have one requirement in form level. I have three field Ex. A, B, C (all checkbox)

if A is  unchecked, B and C should read only and clear value

if A is checked, B and C should editable

if A and B is checked C should be read only and value should cleared

if A and C is checked B should be read only and value should cleared 

Note: All Have OOB Ui policy for if A is  unchecked, B and C should read only and clear value

 

 

5 REPLIES 5

Samaksh Wani
Giga Sage
Giga Sage

Hello @Akshaya14 

 

You need to use OnChange Client Script :-

 

 

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
    if (isLoading || newValue == '') {
          return;
    }
    
   var checkA = g_form.getValue('A');
  var checkB = g_form.getValue('B');
 var checkC = g_form.getValue('C');

if(checkA==false){
    g_form.setReadOnly('B',true);
    g_form.setReadOnly('C',true);
    g_form.setValue('B',false);
    g_form.setValue('C',false);
}

  if(checkA==true){
    g_form.setReadOnly('B',false);
    g_form.setReadOnly('C',false);
   }
  
  if(checkA==true && checkB==true){
    g_form.setReadOnly('C',true);
    g_form.setValue('C',false);
   }

    if(checkA==true && checkC==true){
    g_form.setReadOnly('B',true);
    g_form.setValue('B',false);
   }

   
}

 

 

Plz Mark my Solution as Accept and Give me thumbs up, if you find it helpful.

 

Regards,

Samaksh

Samaksh Wani
Giga Sage
Giga Sage

Hello @Akshaya14 

 

Plz Mark my Solution as Accept and Give me thumbs up, if you find it helpful.

 

Regards,

Samaksh

Akshaya14
Tera Contributor

thanks @Samaksh Wani , but we need three onchange client script. Instead of I achieved via 3 UI policy scripting.

Hello @Akshaya14 

 

In that case, you can split the above script into 3 different client script.

 

Plz Mark my Solution as Accept and Give me thumbs up, if you find it helpful.

 

Regards,

Samaksh