Skip to content

Commit efa7b5e

Browse files
committed
Don't validate a rule server side if it has custom (frontend only) conditions (#183)
1 parent 2e9cc5e commit efa7b5e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Source/Solution/FormEditor/Validation/Validation.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,12 @@ public bool IsValidFor(IEnumerable<FieldWithValue> allCollectedFieldValues, IPub
3232
}
3333
}
3434

35-
// the validation fails if all rules are fulfilled
36-
Invalid = Rules.Where(r => r.IsApplicable).All(r => r.IsFulfilledBy(allCollectedFieldValues, content));
35+
Invalid = Rules.Any(r => r.IsApplicable == false)
36+
// it's impossible to validate the rule if we have frontend only conditions in play
37+
? false
38+
// the validation fails if all rules are fulfilled
39+
: Rules.All(r => r.IsFulfilledBy(allCollectedFieldValues, content));
40+
3741
return Invalid == false;
3842
}
3943
}

0 commit comments

Comments
 (0)