liveBook · Manning

Unobtrusive validation

As explained in Pro ASP.NET Core 7, Tenth Edition

Unobtrusive client-side validation is a validation technique in which rules are represented as HTML attributes and processed by client-side script without embedding validation logic in the markup.

Unobtrusive client-side validation gives users immediate feedback before form submission. ASP.NET Core form tag helpers express field rules as data-val* HTML attributes, while JavaScript interprets those attributes and configures jQuery Validation to perform the checks. section 29.6

A working setup requires the validation libraries in the correct order:

  • Let form tag helpers generate constraints such as data-val-required on inputs. section 29.6

How Pro ASP.NET Core 7, Tenth Edition covers it

How deep it goes
Explains generated attributes, JavaScript adapters, package installation, script order, and rendered markup.
Examples
Uses LibMan package commands, _Validation.cshtml scripts, and a required Name input rendered with data-val attributes.
What you can do after
Apply it via ASP.NET Core form tag helpers, jQuery Validation, and the unobtrusive adapter.
How it connects
Connects ASP.NET Core form tag helpers, HTML attributes, JavaScript, jQuery Validation, and server-side validation.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Pro ASP.NET Core 7, Tenth Edition. The section links point to the parts of the book it draws on.