All docs
V18.2
25.2
The page you are viewing does not exist in version 25.2.
25.1
The page you are viewing does not exist in version 25.1.
24.2
The page you are viewing does not exist in version 24.2.
24.1
The page you are viewing does not exist in version 24.1.
23.2
The page you are viewing does not exist in version 23.2.
23.1
The page you are viewing does not exist in version 23.1.
22.2
The page you are viewing does not exist in version 22.2.
22.1
The page you are viewing does not exist in version 22.1.
21.2
The page you are viewing does not exist in version 21.2.
21.1
The page you are viewing does not exist in version 21.1.
20.2
The page you are viewing does not exist in version 20.2.
20.1
The page you are viewing does not exist in version 20.1.
19.2
The page you are viewing does not exist in version 19.2.
19.1
The page you are viewing does not exist in version 19.1.
18.2
18.1
17.2
A newer version of this page is available. Switch to the current version.

jQuery/JS Common - utils - validationEngine - Methods

This section describes the methods exposed by the DevExpress.validationEngine namespace.

getGroupConfig()

Gets the default validation group.

Return Value:

Object

The default validation group.

The object returned by the getGroupConfig(group) function has the following structure.

  • validators
    An array of Validator widgets that are included to the validated group.
  • validate()
    The method that allows you to validate the widgets included to the current group.
  • validated
    The event that occurs after the group is validated. You can attach/detach a handler using the on(eventName, eventHandler)/off(eventName) methods of the group.
JavaScript
let defaultValidationGroup = DevExpress.validationEngine.getGroupConfig();
// ===== or when using modules =====
import validationEngine from 'devextreme/ui/validation_engine';

let defaultValidationGroup = validationEngine.getGroupConfig();

getGroupConfig(group)

Gets a validation group with a specific key.

Parameters:
group:

String

|

Object

The validation group's name or instance.

Return Value:

Object

The validation group.

The object returned by the getGroupConfig(group) function has the following structure.

  • group
    The string or object passed as the parameter.
  • validators
    An array of Validator widgets that are included to the validated group.
  • validate()
    The method that allows you to validate the widgets included to the current group.
  • validated
    The event that occurs after the group is validated. You can attach/detach a handler using the on(eventName, eventHandler)/off(eventName) methods of the group.
JavaScript
let validationGroup = DevExpress.validationEngine.getGroupConfig('myGroup');
// ===== or when using modules =====
import validationEngine from 'devextreme/ui/validation_engine';

let validationGroup = validationEngine.getGroupConfig('myGroup');

registerModelForValidation(model)

Registers all the Validator objects extending fields of the specified ViewModel.

Parameters:
model:

Object

The ViewModel object has fields extended by the dxValidator objects.

To specify validation rules for ViewModel fields, extend the latter with the dxValidator object.

JavaScript
var viewModel = {
    login: ko.observable("").extend({
        dxValidator: {
            validationRules: [{ type: 'required', message: 'We need your credentials' }]
        }
    }),
    //...
}

To register the rules that are defined within the dxValidator objects, call the DevExpress.validationEngine.registerModelForValidation(model) function passing the ViewModel object as a parameter.

JavaScript
DevExpress.validationEngine.registerModelForValidation(viewModel);

To validate the rules that are defined within the dxValidator objects, call the DevExpress.validationEngine.validateModel(model) function passing the ViewModel object as a parameter.

resetGroup()

Resets the values and validation result of the editors that belong to the default validation group.

DevExpress.validationEngine.resetGroup(); // ===== or when using modules ===== import validationEngine from 'devextreme/ui/validation_engine';

validationEngine.resetGroup();

resetGroup(group)

Resets the values and validation result of the editors that belong to the specified validation group.

Parameters:
group:

String

|

Object

The validation group's name or instance.

DevExpress.validationEngine.resetGroup('myGroup'); // ===== or when using modules ===== import validationEngine from 'devextreme/ui/validation_engine';

validationEngine.resetGroup('myGroup');

unregisterModelForValidation(model)

Unregisters all the Validator objects extending fields of the specified ViewModel.

Parameters:
model:

Object

Specifies the model to unregister.

validateGroup()

Validates editors from the default validation group.

Return Value:

dxValidationGroupResult

The validation result.

let validationResult = DevExpress.validationEngine.validateGroup(); // ===== or when using modules ===== import validationEngine from 'devextreme/ui/validation_engine';

let validationResult = validationEngine.validateGroup();
See Also

validateGroup(group)

Validates editors from a specific validation group.

Parameters:
group:

String

|

Object

The validation group's name or instance.

Return Value:

dxValidationGroupResult

The validation result.

let validationResult = DevExpress.validationEngine.validateGroup('myGroup'); // ===== or when using modules ===== import validationEngine from 'devextreme/ui/validation_engine';

let validationResult = validationEngine.validateGroup('myGroup');
See Also

validateModel(model)

Validates a view model.

Parameters:
model:

Object

The ViewModel object that has fields extended by the dxValidator objects.

Return Value:

Object

To specify validation rules for ViewModel fields, extend the latter with the dxValidator object.

JavaScript
var viewModel = {
    login: ko.observable("").extend({
        dxValidator: {
            validationRules: [{ type: 'required', message: 'We need your credentials' }]
        }
    }),
    //...
}

To register the rules that are defined within the dxValidator objects, call the DevExpress.validationEngine.registerModelForValidation(model) function passing the ViewModel object as a parameter.

JavaScript
DevExpress.validationEngine.registerModelForValidation(viewModel);

To validate the rules that are defined within the dxValidator objects, call the DevExpress.validationEngine.validateModel(model) function passing the ViewModel object as a parameter.

JavaScript
DevExpress.validationEngine.registerModelForValidation(viewModel);