Last change: 30.12.2019
Purpose and Use Case
This example shows how to use the DocumentValidators (available in DR 2.2 and higher) to create a simple layout with multi field validation. The idea is that a control field (in this case a text box, but can also be a boolean check box or anything else) is used to validate or invalidate a set of other fields.
Example: If a form contains a check box for “New Address” the fields of the new address need to be validated and captured. If the check box is not set these fields can be set to valid and ignored.
What it does
The layout contains two groups of fields (A1-A3) and (B1-B3) that are set to valid or invalid based on the value of a control field (Steuerfeld)
In “Steuerfeld” only allow “A” and “B” as values
When “Steuerfeld” is “A” then make fields A1-A3 invalid, make the fields B1-B3 valid
When “Steuerfeld” is “B” then make fields A1-A3 valid, make the fields B1-B3 invalid
Or here as Video:
The behavior is achieved by full access to the document with DocumentValidators (available in DR 2.2 and higher). The same behavior could be achieved by MultiField Validation rules but then the dependent fields need to be configured. The DocumentValidators required a plugin in C# for this layout.
The sample code can be downloaded from below with Vinna DocType, layout.json and validation.json.