Configuration

An object defining configuration options for the dxValidator widget.

adapter

An object that specifies what and when to validate and how to apply the validation result.

Type: Object

This option should be specified when you cannot associate the dxValidator widget with an editor, because, for instance, you use custom editors or a validated value is a concatenation of several DevExtreme editor values. For details, refer to the Validate Custom Editors topic.

See Also

name

Specifies the editor name to be used in the validation default messages.

Type: String

All predefined rules have a default message displayed when the rules are not satisfied by the validated editor values. If you specify the name option of the associated dxValidator object, the option value will be used as an object in the default message. For instance, the "Value is invalid" message will be transformed to "Login is invalid", if you set "Login" for the name option.

onDisposing

A handler for the disposing event.

Type: function
Function parameters:
Provides function parameters.
Object structure:
component: Object
Provides access to the widget instance.
element: jQuery
An HTML element of the widget.
model: Object
Provides access to the data that is available for binding against the element.
Default Value: null

Assign a function to perform a custom action when you dispose of this component.

onOptionChanged

A handler for the optionChanged event.

Type: function
Function parameters:
Provides function parameters.
Object structure:
component: Object
Provides access to the widget instance.
element: jQuery
An HTML element of the widget.
model: Object
Provides access to the data that is available for binding against the element.
value: any
Specifies a new value for the option.
Default Value: null

Assign a function to perform a custom action after an option of the component is changed.

onValidated

A handler for the validated event.

Type: Date
Function parameters:
selectedRowsInfo: Object
Provides function parameters.
Object structure:
name: String
The value of the name option.
isValid: Boolean
Indicates whether all the rules checked for the value are satisfied.
value: Object
The validated value.
validationRules: Array
An array of validation rules specified for the current dxValidator object.
brokenRule: Object
The object representing the first broken rule on the list of specified validation rules.

Assign a function to perform a custom action after an editor value is validated against the specified validation rules.

validationGroup

Specifies the validation group the editor will be related to.

Type: String

Generally, the editors that are associated with dxValidator objects are validated on each value change. But you can combine several editors into a group so that they are validated together (e.g., on a button click). In the Knockout approach, editors should be added to the div element representing the dxValidationGroup component. In this instance, you do not have to specify the validationGroup option for the associated dxValidator objects.

If you use the JQuery approach, the validationGroup option should be specified for the associated dxValidator object to indicate the validation group within which the editor will be validated. Assign the same validation group name for those editors that should be validated together.

validationRules

An array of validation rules to be checked for the editor with which the dxValidator object is associated.

Type: Array

There are several predefined rule types. Each rule type demands a specific set of rule options. Use the Validation Rules section to learn how to define rules of different types.