How to hide/unhide fields (visible event) based on window.variable
Hi Community,
anyone any Idea how to hide/unhide (visible property) fields based on a window variable instead of a form-field value.
For an approval form and workflow I have to show(unhide) the required approver fields based on the output of a query. I prefer to run the query once instead of running it for every approver field ;-)
I have an formload action which sets the window variables at start(initial) to false (0) but when form-input changes a query (to an Authorisation Matrix) is triggered which check which approver-fields have to be enabled.
I set the variables to true (1), but the visible event is not triggered. If I create an additional field in my main list something like useDirectorApprover [Yes/No] and sets this to Yes or No based on query output the visible event is triggerd, but this is not really what I want. I prefer to have as less columns in my main list as possible.
this is how my visible event, type Function Code, looks-like:
return (window.CatDirector==1?true:false);
I can imagine that visible event is only listening/triggering to form-events (form field changes), but is there something I can do without adding a lot of "helper"-columns to achieve the desired behaviour?
Just wondering if there are other options....?
-
Hi Jelle Dijkstra,
you're right, visible functionality is only triggered by changes of form fields referenced in your expression.
Is it possible in your case to group the approver fields into a group control? Then you can show/hide the whole group control with all including fields by a visible expression on that group with just one single query request.
Otherwise you have to set an event handler and write show/hide code of desired controls by yourself.
As there's no event that gets triggered when a variable changes, seems you have to work with getter, setter functions and run your code to show/hide in there. In javascript, how to trigger event when a variable's value is changed? - Stack Overflow
0 -
Thanks Christof,
Unfortunately depending on the outcome of the query I have to inidividually set the approverfields to visible or hidden.I am now using additional columns (Yes/No) as 'helper'-fields. This workarond is more convenient for me that building my own event-handler(s).
regards,
Jelle
0
Please sign in to leave a comment.
Comments
2 comments