Validation

jquery-validation-unobtrusive-extensions, extends the jquery.validate.unobtrusive library by adding:

  1. Globalization support to both format verification, min, max, and range validation rules.
  2. range, min, max are enhanced to work with all inputs(number, date, time, datetime, weak, month).
  3. Enhancement of inputs with validation rules is applied easily to dynamically generated Html. In fact dynamic validation is registred with mvcct-enhancer, so it is enough to call mvcct.enhancer.transform(node) on the root of the newly created node(s), to have validation applied with all other registred transformations.
  4. Format validation of positive integers, integers, floats, dates, datetimes, time, weeks, months, and colours.
  5. Dynamic range validation where the validated input value (number, date, time, datetime, weak, month) must fall inside a list of inputs defining minimum values and a list of inputs defining maximum values.

This module has been designed to work with Asp.net core Mvc and with the Mvc Controls Tollkit Core version that fill automatically all validation data- attributes based on .Net property validation attributes. Thus, the developer is not required to perform any action other than calling mvcct.enhancer.transform(node) on dynamic content and applying appropriate validation attributes.

Mvc Controls Toolkit installation automatically scaffolds everything is needed for jquery-validation-unobtrusive-extensions to work properly. So if one uses standared installation, it is enough to add to a View something like:

@section scripts{
    @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
}

To have enhanced validation enabled in that view.

In case, for some reason, you need a custom installation, please use the information below:

  • jquery.validate.unobtrusive.globalize.js takes care of both globalization and new validation rules
  • jquery.validate.unobtrusive.dynamic.js takes care of dynamic content validation

Both files need a proper installation of mvcct-enhancer and Globalize. Please refer to mvcct-enhance advanced topics for mor information

Moreover, they need the two .js file below be added before them:

  • jquery.validate.js
  • jquery.validate.unobtrusive.js

Please, refer to the module specific documentation for an usage that is independent of the Mvc Controls Toolkit, and specifiacally for all rules definitions.


Fork me on GitHub