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 worked partially for me.  I can hide the top button but not the bottom button. This works to hide the top button:

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

But when I try to hide the bottom but with $$('#action_name')[1].show(); I get an error:

 

find_real_file.png

 

Here is my ui policy:

find_real_file.png

Hi Richard,
 
You can use the below code to hide the bottom button:
$$('#action_name')[2].show();  

--
Thanks,
Nitish

Community Alums
Not applicable

Hi Nitish, it's not working for me. All of my bottom buttons still appear.. How do I do this? Thanks!

Hi, I have found this thread useful but I'm having problems trying to hide the 'Close' button on Change requests when State is not 'Review' and wondered if you could help please?

Adding the condition (current.change_request.state == '0' &&) to the UI action 'Close' works fine but again would prefer to do this without DOM manipulation.

As such have tried a new UI policy with condition

When to run as: State is not Review

and Run scripts as:

if true

function onCondition() {
$$('#state_model_move_to_closed')[0].hide(); //This will hide the top button
$$('#state_model_move_to_closed')[1].hide(); //This will hide the bottom button as well
}

if false

 

function onCondition() {
$$('#state_model_move_to_closed')[0].show(); //This will show the top button
$$('#state_model_move_to_closed')[1].show(); //This will show the bottom button as well
}

Many thanks.

this is not working for me please check , this is form button

find_real_file.png

find_real_file.png