diff --git a/packages/form-js-viewer/src/core/Validator.js b/packages/form-js-viewer/src/core/Validator.js index 4df86206d..a79f9072b 100644 --- a/packages/form-js-viewer/src/core/Validator.js +++ b/packages/form-js-viewer/src/core/Validator.js @@ -76,6 +76,15 @@ export class Validator { errors = runPresetValidation(field, evaluatedValidation, value, errors); + if ('custom' in evaluatedValidation && value && evaluatedValidation.custom.length) { + const { custom } = evaluatedValidation; + custom.forEach(({ condition, message }) => { + if (condition && !runExpressionEvaluation(this._expressionLanguage, value, expressionContextInfo)) { + errors = [...errors, message]; + } + }); + } + return errors; } } @@ -199,7 +208,7 @@ function oldEvaluateFEELValues(validate, expressionLanguage, conditionChecker, f // replace validate property with evaluated value if (evaluatedValue) { - set(evaluatedValidate, path, evaluatedValue); + set(validate, propertyPath.split('.'), evaluatedValue); } });