Is it possible to trigger some validations already after entering data into a field?

Hi all,
I have a form model based on a CDM. The CDM combines the certificate with the client.
In the form, I have a field “insured sum”. With a validation, this field is compared with the field “maximum insured sum” in the client.
The customer now wants, that the validation is already triggered as soon as I entered some data into the field “insured sum” and not only when I try to send the form.
Is that somehow possible? We use currently 2024.06-ext5

Hi @clara-fleet-yew

Yes, this is possible. You can get more information on this topic by watching the Monthly Modeling Highlight “Requiredness” from August 2024 on our training platforms. Whilst the whole video is interesting, the bit you need starts around 30 minutes in.

I’ve created a simple model based on your use-case so I can map the pointsw from the Monthly Modeling Highlight to your use-case:
ValidationTrigger_DM.json (15.5 KB)

The issue you are facing arises from the way validations are triggered in the frontend in A12. When you leave the field “InsuredSum” this field is validated. Validation Rules can also fire as long as there is enough information. For example:

  • [InsuredSum] > 100 could fire as you compare the field value that you are entering to a constant.
  • [InsuredSum] > [../Client/MaximumInsuredSum] will not fire when leaving the field “InsuredSum” as the validation scope only contains that field. The other data is unknown. (InsuredSumLessThenMax_1 in the model)

So how can you make “MaximumInsuredSum” be in the scope of the validation? Here you have two options.

  1. Make “MaximumInsuredSum” global
  2. Use a computed Helper Field

Both of these solutions work in either a repeatable or non-repeatable context.

Make “MaximumInsuredSum” global
The Global flag in the DM Field Editor allows you always include a Field in the Validation scope. As a result, this rule (InsuredSumLessThenMax_2 in the model) can fire when you leave the field “InsuredSum” as both fields are in the Validation scope.

[InsuredSum] > [../Client/MaximumInsuredSum_Global]

Caution - Setting the Global flag will affect every rule that references this Field.

Use a computed Helper Field
To achieve the same result without affecting other Validation Rules, you can model a computed Helper Field. This is great as changing a Field Value leads to (Form Engine docs):

Single field validation + validation of all visible fields changed via computations and/or dependencies

This means that the computed Helper Field is also in scope when we change the value of “InsuredSum” as long as it is visible on the screen. This means we can compute the Validation result into the Helper Field:

[InsuredSum] > [../Client/MaximumInsuredSum] returns True

and then model a validation rule AllFieldsFilled(InsuredSum,HelperField)

Remember, if you don’t want to show the Helper Field you can simply mark it as global.

FYI - as you mentioned the Form Model is based on a CDM…

Linking two documents does not trigger a validation.

This means that if the fields “insured sum” and “maximum insured sum” are filled on two different documents then linking these two documents will not trigger a validation.

In this case, you need to check if the link is present and use a computed Helper Field. See here for more information on determining if a link exists in CDMs.