I'm trying to get validation rules set up on our project to work from just giving validation classes to inputs. I found the built-in validation API ($public.Validation.setWidgetAsInvalid) and already have found that it doesn't work if you use it in a client action on the Logic tab. It has to be in a screen client action.
I got it to work in a test where the validation block contains all of the inputs being validated, but when I try to make a generic solution that validates all fields on the page instead of fields inside of the block, it breaks.
I'm attaching the oap file with the two modules I'm using for these tests. The 'ValidationTests' module shows a working example as well as the example that throws the error in my title.
Hi Eric,
I have been struggling with this in the past.
There are 2 things to solve :
Each block screen has his own $public.validation... context with access to execute the api only on its own fields, so you´ ll have to pass them into your generic solution.
You´ll have to find a way to trigger a rerender on each screen / block from within your generic solution .
I´ ll try to make a demo app tonight.
Dorine
see attached demo oml
So here's what is going on :
Caveat 1 : I'd like to add that all of this might have a lot of overlap with existing built-in validations, and I'm not sure I fully understand why it is not just done with straight-forward low code validation logic in a screen action, but if those are not covering your needs, above might be a direction to explore.
Caveat 2 : None of the above is thouroughly tested, just a demo of the direction you could take