You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes we want a validator to be executed only if a certain condition is matched. For example, we want a validator on a field only if another field has a certain value.
It is currently possible but inconvenient to do so. We should introduce a new OnlyIf validator (or another more suited name if you have better ideas) that only executes a given validator if a condition is met, otherwise returns true.
In this example, MyValidator would only be executed if the other field has the value true. If the condition returns false, the validation passes without executing MyValidator.
The message placeholders and other properties must be inherited from MyValidator.
The text was updated successfully, but these errors were encountered:
Proposal
Sometimes we want a validator to be executed only if a certain condition is matched. For example, we want a validator on a field only if another field has a certain value.
It is currently possible but inconvenient to do so. We should introduce a new
OnlyIf
validator (or another more suited name if you have better ideas) that only executes a given validator if a condition is met, otherwise returnstrue
.Example usage:
In this example,
MyValidator
would only be executed if theother
field has the valuetrue
. If the condition returnsfalse
, the validation passes without executingMyValidator
.The message placeholders and other properties must be inherited from
MyValidator
.The text was updated successfully, but these errors were encountered: