From a3629ce68cbcf5b2ea05314af129ec2bb0739b06 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 11 Aug 2021 14:59:12 +0100 Subject: [PATCH] Prevent not-equals from failing on fields that are both empty --- packages/standard-components/src/forms/validation.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/standard-components/src/forms/validation.js b/packages/standard-components/src/forms/validation.js index 3332932eb9..d52397f7c6 100644 --- a/packages/standard-components/src/forms/validation.js +++ b/packages/standard-components/src/forms/validation.js @@ -248,7 +248,11 @@ const equalHandler = (value, rule) => { // Evaluates a not equal constraint const notEqualHandler = (value, rule) => { - return !equalHandler(value, rule) + const ruleValue = parseType(rule.value, rule.type) + if (value == null && ruleValue == null) { + return true + } + return value !== ruleValue } // Evaluates a regex constraint