React Validator - CompareRule
A validation rule that demands that a validated editor has a value that is equal to a specified expression.
To specify the expression that the validated field must match, set the rule's comparisonTarget configuration option. Assign a function to this option. The validated value will be compared to the function's return value. The comparison will be performed by using the operator that is set for the comparisonType option.
See Also
comparisonTarget
The rule is valid if the validated value is equal to the return value of the comparisonTarget function.
comparisonType
Specifies the operator to be used for comparing the validated value with the target.
When using the widget as an ASP.NET MVC Control, you can specify this option using the ComparisonOperator
enum. This enum accepts the following values: Equal
, NotEqual
, StrictEqual
, NotStrictEqual
, GreaterThan
, GreaterThanOrEqual
, LessThan
and LessThanOrEqual
.
message
You do not have to specify this field. In this instance, a default message will be shown. To include the name of the validated editor into the default validation message as a subject, set the name field of the dxValidator object.
If you assign an empty string to the message field, the message will not be shown.
reevaluate
Indicates whether or not the rule should be always checked for the target value or only when the target value changes.
type
Set this field to 'compare' to define a rule that will be broken if the validated value does not equal to the return value of the specified comparisonTarget function.
If you have technical questions, please create a support ticket in the DevExpress Support Center.