JavaScript/jQuery Validator - RangeRule
A validation rule that demands the target value be within the specified value range (including the range's end points).
import { RangeRule } from "devextreme/common"
Type:
To specify the range that the validated value must match, set the rule's min and max configuration properties. 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.
See Also
message
Type:
Default Value: 'Value is out of range'
An error message can be specified as follows:
Hard-code the message
index.js- $(function() {
- $("#textBox").dxTextBox({ ... })
- .dxValidator({
- type: "range",
- message: "My custom message"
- });
- });
Hide the message
index.js- $(function() {
- $("#textBox").dxTextBox({ ... })
- .dxValidator({
- type: "range",
- message: ""
- });
- });
Display the editor's name in the message
index.js- $(function() {
- $("#textBox").dxTextBox({ ... })
- .dxValidator({
- name: "Age", // The error message will be "Age is out of range"
- validationRules: [{
- type: "range"
- }]
- });
- });
reevaluate
Indicates whether the rule should be always checked for the target value or only when the target value changes.
Type:
Default Value: false
Feedback