Revalidation through adjusting relevant field

Hello,

I have the situation, that I have a model which contains two fields of type boolean, which can’t be both true at the same time. To validate this I made a Validation Rule with the condition [Field1] == True AND [Field2] == True and error Field Field1

If the user now solves the problem by unselecting Field2 the error message is still shown (in the form engine). So it seams, that the validation doesn’t run again after a change of a relevant field of the validation, only for the field defined as error field.
Is this really the expected behaviour? Is there a way I can change this, so the revalidation happens on changing either Field1 or Field2?

Thanks in advance

Hi @nora-azure-stem

Yes, this is the expected behavior. You need to consider the scope of the validation, as mentioned Validation does not work if enumeration and boolean are used for it - #4 by mcaemmerer

When you change a single value in the form, the Form Engine validates

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

as stated here.

This means that when you change Field2, you perform a partial validation where only Field2 is in scope. This cannot evaluate you error condition

[Field1] == True AND [Field2] == True

As Field1 is not in the scope of the validation and the value is therefore unknown.

However, you make some changes to the models:

  • Set Field1 and Field2 to be “Global”
  • (Use a Computation)

Global
Global Fields are always in the scope of validation. By setting Field1 and Field2 to be “Global”, you can always evaluate:

[Field1] == True AND [Field2] == True

However, this can lead to knock-on effects as these Fields will be in scope for every single field value change that you make on the form.

Use a Computation
Computation Rules are updated on every Field Value change. The Computed Field is then validated, as stated above. It’s easy if you can display the error message on the computed field but I haven’t found a modeling workaround to update the error message on Field1 when Field2 is updated.

Validation_DM.json (10.0 KB)
Validation_FM.json (6.1 KB)

FYI there is already an open ticket looking at adapting the list of fields that are in scope, A12-17201. However, it is not planned in the immediate future.

Hi @malcolm-silver-ice ,

thank you for your answer and the suggestions.
I will try to go with the “global” flag.

Best regards