Unable to hide currency field

shaik23
Tera Expert

Hi,

i have a requirement, i want to hide currency field based on request type. When request type is Disposal or Mass disposal then the currency type should visible.

i have tried with UI policies' but didn't work then, i wrote Onchange client script still it showing the field when the request type is none, when the page loads if i select disposal or mass disposal the field is  visible but when i change the request type again to none the currency field remains visible.

 

This is the script i written please suggest if anything wrong.

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
   if (isLoading || newValue === '') {
      return;
   }
   var requestType = g_form.getValue('u_request_type');
    var bookValueField = g_form.getControl('u_book_value');

    if (requestType === 'Disposal' || requestType === 'Mass Disposal') {
       
        g_form.setVisible('u_book_value', true);
    } else {
        g_form.setVisible('u_book_value', false);      
    }
}
 if (g_form.isNewRecord()) {
    g_form.setVisible('u_book_value', false);
 }
   
7 REPLIES 7

Rahul Talreja
Mega Sage
Mega Sage

Hi @shaik23 ,
Can you please share the UI Policy and UI Policy Action? the best suggested way to achieve this will be via UI policy only...

If you still wish to continue with Client script, let me know!

Please mark my response correct/helpful as applicable!
Thanks and Regards,
Rahul

Hi @Rahul Talreja 

i have tried with Ui policies and ui Action as visible true but it didn't work. i have attached screen shot 

@shaik23 ,
Try with below code!

   if (isLoading || newValue === '') {
      return;
   }
g_form.setVisible('u_book_value', false);
   var requestType = g_form.getValue('u_request_type');
    var bookValueField = g_form.getControl('u_book_value');

    if (requestType === 'Disposal' || requestType === 'Mass Disposal') {
       
        g_form.setVisible('u_book_value', true);
    } 
}
Please mark my response correct/helpful as applicable!
Thanks and Regards,
Rahul