JavaScript/jQuery Validator - NumericRule
A validation rule that demands that the validated field has a numeric value.
import { NumericRule } from "devextreme/common"
Type:
message
Specifies the message that is shown if the rule is broken.
Type:
Default Value: 'Value should be a number'
You can configure an error message in the following ways:
Specify a hard-coded message:
index.js- $("#textBox").dxTextBox({
- // ...
- }).dxValidator({
- type: "numeric",
- message: "My custom message"
- });
Hide the message:
index.js- $("#textBox").dxTextBox({
- // ...
- }).dxValidator({
- type: "numeric",
- message: ""
- });
Display the editor's name in the default message (for instance, "Age should be a number"):
index.js- $("#textBox").dxTextBox({
- // ...
- }).dxValidator({
- name: "Age",
- validationRules: [{
- type: "numeric",
- }],
- });