#1 2020-02-20 16:12:00

Registered: 2019-06-21
Posts: 5

Add validation to compare values of two fields

Hi All. I am trying to include in the model validations to compare values from various fields, for example I need field A to be always larger than field B. For this I am implementing a new class inheriting from TSynValidateRest, and eventually using it in the AddFilterOrValidate method. I have defined the parameters to be of the format: FIELD:OPERATOR. For example:
         AddFilterOrValidate('FieldA', TSynValidateNumber.Create('{FieldB:GT}'));
That would mean that the value of FieldA must be greater than that of FieldB.

Is that a valid path, or should I use another solution? What do you recommend?


Board footer

Powered by FluxBB