Vue 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:
App.vue- <template>
- <DxTextBox>
- <DxValidator>
- <DxStringLengthRule
- message="My custom message"
- />
- </DxValidator>
- </DxTextBox>
- </template>
- <script setup lang="ts">
- import { DxTextBox } from 'devextreme-vue/text-box';
- import { DxValidator, DxStringLengthRule } from 'devextreme-vue/validator';
- </script>
Hide the message:
App.vue- <template>
- <DxTextBox>
- <DxValidator>
- <DxStringLengthRule
- message=""
- />
- </DxValidator>
- </DxTextBox>
- </template>
Display the editor's name in the default message (for instance, "The length of the password is not correct"):
App.vue- <template>
- <DxTextBox>
- <DxValidator name="password">
- <DxStringLengthRule />
- </DxValidator>
- </DxTextBox>
- </template>
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.