RangeRule

A validation rule that demands the target value be within the specified value range (including the range's end points).

Type:

Object

To specify the range that the validated value must match, set the rule's min and max configuration options. Note that the specified range can be on a date-time or numeric scale. To validate a value against a string length, use the stringLength rule.

Show Example:
AngularJS
Knockout
jQuery

In this example, the 'range' rule is applied to the editor. This rule demands that the editor value be within 25 and 35. To check this rule, specify a value out of this range.


                                    

                                    

In this example, the 'range' rule is applied to the editor. This rule demands that the editor value be within 25 and 35. To check this rule, specify a value out of this range.


                                    

                                    

In this example, the 'range' rule is applied to the editor. This rule demands that the editor value be within 25 and 35. To check this rule, specify a value out of this range.


                                    

                                    

max

Specifies the maximum value allowed for the validated value.

Type:

Date

|

Number

message

Specifies the message that is shown to end-users if the current rule is broken.

Type:

String

Default Value: 'Value is out of range'

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.

min

Specifies the minimum value allowed for the validated value.

Type:

Date

|

Number

reevaluate

Indicates whether the rule should be always checked for the target value or only when the target value changes.

Type:

Boolean

Default Value: false

type

Specifies the type of the current rule.

Type:

String

Accepted Values: 'range'

Set this field to 'range' to define a rule that will be broken if the validated value does not match the range specified by the min and max configuration options.