Validator

A widget that is used to validate the associated DevExtreme editors against the defined validation rules.

Included in: dx.mobile.js, dx.web.js, dx.viz-web.js, dx.all.js
Module: ui/validator
Export: default

You can create the Validator widget using one of the following approaches.

  • jQuery

    HTML
    <div id="textBox1"></div>
    JavaScript
    $(function() {
        $("#textBox1").dxTextBox({ })
            .dxValidator({
                validationRules: [
                    // ...
                ]
            });
    });
  • AngularJS

    HTML
    <div dx-text-box="{ }"
         dx-validator="{
             validationRules: [
                // ...
            ]
        }">
    </div>
  • Knockout

    HTML
    <div data-bind="dxTextBox: { },
        dxValidator: {
            validationRules: [
                // ...
            ]
        }">  
    </div>

Note that DevExtreme widgets require you to link the jQuery library to your application. If you use the Knockout or AngularJS approach, the Knockout or AngularJS library is also required. For detailed information on linking these libraries to your project, refer to the topics in the Installation section.

See Also

The learn the validation rules that can be defined using the Validator widget for an editor, refer to the Validation Rules section.

The editors that are associated with the Validator widgets are automatically validated against the specified rules each time the event assigned to the editor's valueChangeEvent option occurs. In addition, several editors can be validated at once. To learn how to do this, refer to the Validate Editor Values topic.

See Also

View Demo Watch Video

Configuration

An object defining configuration options for the Validator widget.

Methods

This section describes members used to manipulate the widget.

Events

This section describes events fired by this widget.

Validation Rules

This section lists validation rules that can be used within the dxValidator.