JavaScript/jQuery Validator - StringLengthRule
A validation rule that demands the target value length be within the specified value range (including the range's end points).
import { StringLengthRule } from "devextreme/common"
Type:
message
Specifies the message that is shown if the rule is broken.
Type:
Default Value: 'The length of the value is not correct'
You can configure an error message in the following ways:
Specify a hard-coded message:
index.js- $("#textBox").dxTextBox({
- // ...
- }).dxValidator({
- type: "stringLength",
- message: "My custom message"
- });
Hide the message:
index.js- $("#textBox").dxTextBox({
- // ...
- }).dxValidator({
- type: "stringLength",
- message: ""
- });
Display the editor's name in the default message (for instance, "The length of the password is not correct"):
index.js- $("#textBox").dxTextBox({
- // ...
- }).dxValidator({
- name: "password",
- validationRules: [{
- type: "stringLength",
- }],
- });
trim
Indicates whether or not to remove the Space characters from the validated value.
Type:
Default Value: true
To keep the Space characters within the validated value, set this field to false.