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/ui/validation_rules"
Type:
message
Type:
Default Value: 'The length of the value is not correct'
An error message can be specified as follows:
Hard-code the message
index.js- $(function() {
- $("#textBox").dxTextBox({ ... })
- .dxValidator({
- type: "stringLength",
- message: "My custom message"
- });
- });
Hide the message
index.js- $(function() {
- $("#textBox").dxTextBox({ ... })
- .dxValidator({
- type: "stringLength",
- message: ""
- });
- });
Display the editor's name in the message
index.js- $(function() {
- $("#textBox").dxTextBox({ ... })
- .dxValidator({
- name: "password", // The error message will be "The length of the password is not correct"
- validationRules: [{
- type: "stringLength"
- }]
- });
- });
type
Type:
Accepted Values: 'required' | 'numeric' | 'range' | 'stringLength' | 'custom' | 'compare' | 'pattern' | 'email' | 'async'
Feel free to share topic-related thoughts here.
If you have technical questions, please create a support ticket in the DevExpress Support Center.
Thank you for the feedback!
If you have technical questions, please create a support ticket in the DevExpress Support Center.