can we hide custom button using onchange client script ?

String
Kilo Sage

Hi Team ,

We created a custom button in the form .

My requirement is when user changes the state field ,we are making few fields  blank and want to hide/disable the custom button .

 

 

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
g_form.setValue('date', "");
g_form.setValue('last_com', "");

 

we are making few fields blank ,but how to make custom button hide/disable ?

Please guide 

7 REPLIES 7

DanielCordick
Mega Patron
Mega Patron

Samaksh Wani
Giga Sage
Giga Sage

Hello @String 

 

1) Create a UI Policy --> Set Condition as field (check_box) is true

 

2) In the Script tab set Run scripts true

 

3) In the if condition write        

 

                  $$('#action_name')[0].hide();     //This will hide the top button

 

                  $$('#action_name')[1].hide();     //This will hide the bottom button as well



4) In the else condition write        

 

                  $$('#action_name')[0].show();     //This will show the top button

 

                  $$('#action_name')[1].show();     //This will show the bottom button as well



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

 

Regards,

Samaksh

Hi @Samaksh Wani  thanks for your quick reply ,we using scope application 

 

We are using two buttons on top ,so when state changes one button should show and second button should disable/hide 

Please guide me 

Hello @String 

 

Go to UI policy, add your If Condition with state changes , in it add it

 

3) In the if condition write        

 

                  $$('#action_name')[0].hide();     //This will hide the top button

 

                  $$('#action_name')[1].show();     //This will hide the bottom button as well



4) In the else condition write        

 

                  $$('#action_name')[0].show();     //This will show the top button

 

                  $$('#action_name')[1].show();     //This will show the bottom button as well