Hi,
I have a form with 2 button tabs A and B. Each one displays a section with fields (section A and Section B).
Initially, the section A is visible (section B not visible).
How may I validate the fields of the section B?
My Submit button validates only the visible fields section, so, if fields of section A are correct (and fields of Section B are not), the form is wrongly submitted.
Regards
Discussion posts and replies are publicly visible
Hi Cedric,
Please consider handling the validation at form level upon submission. Check the below link
https://docs.appian.com/suite/help/20.3/Validation_Message.html
Regards,
Pedro
It gets trickier to deal with when you need to do it this way, but after you've implemented it you'll have a lot more power/control at least.
First, you should keep track of the validity of each section (overall) in a local variable. i.e. local!SectionAHasValidationError (boolean), etc. Utilizing a!localVariables() under default settings, you should simply be able to evaluate the validity of your Section A fields with normal logic in the variable definition, and it would update itself anytime any of those values is changed.
Then, as Pedro said above, add a Form Level validation which fires at the Submit event, which itself checks which (if any) of the Section X Validation Error variables is "true", and perhaps advises the user which section has the error - they can then switch back to that section and see the particular validations on the fields themselves.
Thank you Pedro.Even if the formLyaout is the better way, I was looking for a solution without it...
Thank you Mike for this idea (I was testing such a one),
but how (where) do you set this var local!SectionAHasValidationError ?
In the SaveInto of each field? (I have more than 30 fields)
Can't we do that once?
(I've tried to do it in the "validations" section, but how? as "a!save" is forbidden)
You would set that and similar local variables in the top-level variable declaration of your form. As I already mentioned, the variable will re-evaluate automatically when any of the other data it uses is changed (assuming you're using a!localVariables() under default settings).
ok, using a formlayout is mandatory in your example.I was trying a solution without a formlayout.
cedric01 said:using a formlayout is mandatory in your example
For a process task, I'd suggest that using a!formLayout is mandatory in general. That's not strictly true, I guess - you could just use a sectionLayout and manually created button layout... but why would you want to? the FormLayout component just makes things easier.
Ok I understand, thank you Mike.
A last thing, how would you do what I need with a headerContentLayout?(we have no formLayout just a headerContentLayout)
docs.appian.com/.../Header_Layout.html
You'd need to put the validation in one of your SectionLayouts then.