ValidationSummary

A widget for displaying the result of checking validation rules for editors.

Included in: dx.phonejs.js, dx.webappjs.js, dx.all.js

This widget has a collection of items that present the validation errors that currently exist in a validation group or the ViewModel to which the widget is related.

dxValidationSummary Widget

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

  • jQuery
    Use the dxValidationSummary jQuery plug-in.

    HTML
    <div id="textBox1"></div>
    <div id="textBox2"></div>
    <div id="summary"></div>
    <div id="button"></div>
    JavaScript
    var validationGroup = "sampleGroup";
     $("#textBox1").dxTextBox({})
        .dxValidator({
            validationRules: []
        });
    $("#textBox2").dxTextBox({})
        .dxValidator({
            validationRules: []
        });
    $("#summary").dxValidationSummary({ });
    $("#button").dxButton({});
  • Knockout
    Add a div element and apply the dxValidationSummary binding to this element.

    HTML
    <div data-bind="dxTextBox: { },
        dxValidator: { validationRules: [] }">  
    </div>
    <div data-bind="dxTextBox: { },
        dxValidator: { validationRules: [] }"> 
    </div>  
    <div data-bind="dxValidationSummary: { }"></div>
    <div data-bind="dxButton: { }"></div>
  • AngularJS
    Add a div element and apply the dx-validation-summary directive to this element.

    HTML
    <div ng-controller="demoController">
        <div dx-text-box="{  }"
            dx-validator="{ validationRules:  }">  
        </div>
        <div dx-text-box="{  }"
            dx-validator="{ validationRules:  }">  
        </div>
        <div dx-validation-summary="{  }"></div>
        <div dx-button="{ }"></div>
    </div>

Note that DevExtreme widgets require you to link the jQuery and Globalize libraries 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.

The summary items are displayed using the default item template that is based on the message field of the broken validation rule. However, you can use a custom item template.

See Also

NOTE: The currently existing validation errors are not only the errors that are discovered during the current validation, but also the validation errors that are discovered during the earlier validations if the not-valid values are not changed since then.

To learn more on how to create the dxValidationSummary widget and associate it with the required validation group or ViewModel, refer to the Display Validation Errors and Validate View Model topics.

Show Example:
AngularJS
Knockout
jQuery

Configuration

An object defining configuration options for the widget.

Methods

This section describes members used to manipulate the widget.

Events

This section describes events fired by this widget.

Default Item Template

This section lists the data source fields that are used in a default item template.

By default, a predefined item template is applied to display the items of this widget. This template is based on certain fields of the data source provided for this widget. Below is the list of these fields. If the default item template is not appropriate for your task, implement a custom item template based on these or other fields of your data source.

See Also