How to hide UI Action based on field change in form without using DOM?

elanrajad
Tera Contributor

Hi Team,

We have check box field on form if check box is checked need to hide button without saving the form and if check box is unchecked   need to show   the button on form without using DOM .Any one Can help me..

Thanks

Elanraj

1 ACCEPTED SOLUTION

nitish99
Tera Guru

Hi Elanraja,



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



For reference,


check this How to hide/show an UI action on field changes


View solution in original post

29 REPLIES 29

This way to hide and show a UI Action is okey, but just work whith the top button, to hide and show the bottom button, you have to add "_bottom" and change the position to 0, so the correct way is the following

 

To hide

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

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

to show

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

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

 

RM238
Tera Contributor

Hey Eduardo and all, I tried above code as well (along with above suggestions) but still not working. My requirement is simple. To hide ALL the bottom buttons. No condition.

I created onLoad client script and put the following codes but the bottom bottom still there!

 

function onLoad() {
//not working
//$$('div.form_action_button_container')[1].setStyle({display: 'none'});
//$$('div.form_action_button_container')[0].setStyle({display: 'none'});

 

//not working
//$j('.form_action_button_container').hide();

 

//not working either
$$('#approve_bottom')[0].hide();
$$('#reject_bottom')[0].hide();
$$('#request_approval_bottom')[0].hide();
$$('#metric_definition_thresholds_bottom')[0].hide(); //aggregate, update, copy threshold, delete
$$('#sysverb_delete_bottom')[0].hide();
$$('#metric_definition_aggregate_bottom')[0].hide();

}

 

can anyone help me, please?

Eduardo7
Tera Contributor

I just have replicated my code in my personal instance, but it doesn't work, just work in my work instance and both are in the same realese, is really strange, but there are more options to hide ui action.

 

1.- Throgh Ui action condition, you can write a condition to hide that button

Eduardo7_0-1668181009238.png

But if you dont need conditions and you want to hide the buttons all time, you can do the following:

 1.- Create a new view whit same sections and fields that the default view.

    *Click in the banner menue and select configure - > form layout

Eduardo7_1-1668181334029.png

    *Click in view name and select new

Eduardo7_2-1668181402462.png

Eduardo7_3-1668181512091.png

 

 2.- Create a view rule to redirect users to the view that you just have created.

    *Type view rule in the filter navigator and select System ui -> view rules

Eduardo7_4-1668181638839.png

   *Click in new and fill the fields

Eduardo7_5-1668181819314.png

 *Be shure write the correct name of your view, the technical name of the view change to lowercase and be shure select the correct table where you view rule will applie

 3.-Paste this table name in the filter navigator "sys_ui_action_view.LIST" and click on enter

   *Click in the list view of the table, click in new button

   *Fill the fields

    UI action visibility: select the ui action you want to hide.

Eduardo7_7-1668182247466.png

   view: select the view you have just created

   visibility: select exclude and submit the form

Eduardo7_8-1668182353214.png

now, go to your form and reload:

Eduardo7_9-1668182407932.png

Now, the resolve button is not in the form

 

 

 

To hide more Ui action, just follow from step 3 onwards

RM238
Tera Contributor

Many thanks, @Eduardo7 , unfortunately, the configuration also hide my top button. I tried the solution that you gave. What am I missing? I just want to hide bottom button. Advanced thanks!