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

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

  • jQuery
    Apply the dxValidator jQuery plug-in to an editor instance.

    HTML
    <div id="textBox1"></div>
    JavaScript
     $("#textBox1").dxTextBox({})
        .dxValidator({
            validationRules: []
        });
  • Knockout
    Apply the dxValidator binding to the div element that is bound to an editor.

    HTML
    <div data-bind="dxTextBox: { },
        dxValidator: { validationRules: [] }">  
    </div>
  • AngularJS
    Apply the dx-validator directive to the div element that represents an editor.

    HTML
    <div ng-controller="demoController">
        <div dx-text-box="{  }"
            dx-validator="{ validationRules:  }">  
        </div>
    </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 Installation article.

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

Configuration

An object defining configuration options for the dxValidator 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.