The CreatorCon Call for Content is officially open! Get started here.

Put a button on a form in an initial hidden state

gmbroth
Kilo Contributor

Hi,

I could use community advice on an implementation issue: I'd like to put a button on a form but have it initially displayed as hidden. Once my form loads (and the button is not visible) I'll then use logic in the onLoad and onChange (for a specific field) scripts to either leave the button hidden or show it.

Unfortunately, the UI Action responsible for displaying the button always renders it as visible (if its Condition evaluates true); if the Condition evaluates false, the button is not added to the form. There is an option to use UI Action Visibility but that suffers from drawbacks: switching views submits the form (my button should be visible before the form is submitted) and you can't switch views on a new form that hasn't been saved yet (my button must be visible on unsaved forms).

My solution is to configure UI Action to show the button and then hide it as necessary using logic in the onLoad script. This does the trick but the button is visible momentarily on the initial page load before the onLoad script can hide it. Is there another approach to putting a button on a form in an initial hidden state?

Thanks, Garry

1 ACCEPTED SOLUTION

Hi Garry,



Yes, I would do one of these.



1. Let the UI Action remain all the time on the form, and do the GlideAjax from the UI Action(on demand), If the CI Exists redirect the user, else alert saying no CI's found. I wont do a GlideAjax unless until necessary especially in this case(REST Message Outbound).


2. Use Field Decoration Macro, That would be visible only when conditions met.



Hope that make sense!!!



Thanks


Srinivas


Mark this answer as helpful/correct if it does so


View solution in original post

9 REPLIES 9

Hi Kalai,



This is clever and I didn't know about it; I've bookmarked it for future use - thanks!



Garry


FWIW, This sounds similar to the client script Garry was saying he didn't like. The button will appear for a while until the client scripts have loaded and run, then it disappears if the condition is met. A UI Policy is functionally the same as a client script in this case.


I am under the impression that the question talked about showing/hiding a button onchange of something.


Hi Garry,



Yes, I would do one of these.



1. Let the UI Action remain all the time on the form, and do the GlideAjax from the UI Action(on demand), If the CI Exists redirect the user, else alert saying no CI's found. I wont do a GlideAjax unless until necessary especially in this case(REST Message Outbound).


2. Use Field Decoration Macro, That would be visible only when conditions met.



Hope that make sense!!!



Thanks


Srinivas


Mark this answer as helpful/correct if it does so


Hi Srinivas,



Yes, your option #1 makes good sense; it's what I'm going to do - thanks!



And thanks too to the community in general for reading and responding.



Garry