Angular Common - utils - validationEngine - Methods
getGroupConfig()
Use this method to get an object defining the validation group that combines the editors created by the jQuery Approach and for which the validationGroup option is not specified.
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.
getGroupConfig(group)
A validation group's key can be represented in the following manner.
A ValidationGroup instance
If it is not accessible in the current context in code, access it in the following manner.JavaScript$("#myGroup").dxValidationGroup("instance");
A string name
When you use the jQuery approach for validation, a validation group is usually a string because it is the simplest way to unite several widgets in one group - by setting the same group name for the validationGroup configuration option of the associated dxValidator objects. In this and other similar cases, where you specify a validation group as a string, pass the validation group name as a parameter to the validateGroup(group) function.
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.
registerModelForValidation(model)
Registers all the Validator objects extending fields of the specified ViewModel.
To specify validation rules for ViewModel fields, extend the latter with the dxValidator object.
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.
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()
Use this method to reset the validation result for the validation group that combines the editors created by the jQuery Approach and for which the validationGroup option is not specified. This method calls the reset method for this group.
resetGroup(group)
Resets the values and validation result of the editors that belong to the specified validation group.
This method calls the reset method for the specified group.
A validation group's key can be represented in the following manner.
A ValidationGroup instance
If it is not accessible in the current context in code, access it in the following manner.JavaScript$("#myGroup").dxValidationGroup("instance")
A string name
When you use the jQuery approach for validation, a validation group is usually a string because it is the simplest way to unite several widgets in one group - by setting the same group name for the validationGroup configuration option of the associated dxValidator objects. In this and other similar cases, where you specify a validation group as a string, pass the validation group name as a parameter to the validateGroup(group) function.
unregisterModelForValidation(model)
Unregisters all the Validator objects extending fields of the specified ViewModel.
validateGroup()
Use this method to validate the editors from the default validation group that combines the editors created by the jQuery Approach and for which the validationGroup option is not specified.
The returned object contains the following fields:
isValid: Boolean
Indicates whether all the rules checked for the group are satisfied.brokenRules: Array
Rules that failed to pass the check. Their structure is described in the Validation Rules section.validators: Array
Validator widgets included in the validated group.
To validate editors belonging to the default validation group and created using the Knockout Approach, call the validateGroup(group) method passing the view model as a parameter.
To validate editors belonging to the default validation group that are also created using the AngularJS Approach, call the validateGroup(group) method passing the $scope object as a parameter.
See Also
validateGroup(group)
A validation group's key can be represented in the following manner.
A ValidationGroup instance
If it is not accessible in the current context in code, access it in the following manner.JavaScript$("#myGroup").dxValidationGroup("instance")
A string name
When you use the jQuery approach for validation, a validation group is usually a string because it is the simplest way to unite several widgets in one group - by setting the same group name for the validationGroup configuration option of the associated dxValidator objects. In this and other similar cases, where you specify a validation group as a string, pass the validation group name as a parameter to the validateGroup(group) function.
The returned object contains the following fields:
isValid: Boolean
Indicates whether all the rules checked for the group are satisfied.brokenRules: Array
Rules that failed to pass the check. Their structure is described in the Validation Rules section.validators: Array
Validator widgets included in the validated group.
See Also
validateModel(model)
To specify validation rules for ViewModel fields, extend the latter with the dxValidator object.
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.
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.
DevExpress.validationEngine.registerModelForValidation(viewModel);
The returned object contains the following fields:
isValid: Boolean
Indicates whether all the rules checked for the group are satisfied.brokenRules: Array
Rules that failed to pass the check. Their structure is described in the Validation Rules section.validators: Array
Validator widgets included in the validated group.
If you have technical questions, please create a support ticket in the DevExpress Support Center.