How can I set two fields to be mandatory, and have one hide and be null if the other has a value?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-30-2022 07:39 AM
I have a form whereby I created 2 UI policies to hide a given field and set it equal to null, if the other has been populated and vice versa (see screenshots).
However I need them to both be mandatory prior to one being given a value. If I set their dictionary to mandatory, then the field that would have previously been hidden, no longer is when the other has a value.
How can I set these to both be mandatory, until one has a value, and then hide? Is something missing from my UI policy script? Thank you
UI policy script logic is:
function onCondition() {
g_form.setDisplay('consumer', false);
g_form.setValue("consumer", null);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-30-2022 07:44 AM
Hi Alex,
You create another UI Policy with a lower order no(so that it triggers first) and set the fields mandatory.
Then in the UI policy script(mind you that this can be achieved with the UI Policy Action - both what you wrote and the additional requirements) you also add g_form.setMandatory("customer", false);
Please give it a try and provide feedback.
Tudor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-06-2022 12:37 AM
Thanks for the above. Your logic was what I needed, but I also noted that no code was required and this could be done with Policy Actions only.