Data-val-* attribute
A data-val-* attribute is an HTML data attribute convention for encoding validation metadata used by unobtrusive client-side validation.
Pro ASP.NET Core 7, Tenth Edition
A data-val attribute is an HTML data attribute emitted by ASP.NET Core to provide client-side validation metadata.
- How it is used
- Supplies HTML metadata that unobtrusive JavaScript uses to validate form fields before submission.
- How deep it goes
- Shows generated attributes and the scripts that consume them, but does not detail the JavaScript validator’s internals.
- Examples
- Uses generated ProductId and Name inputs, validation script listings, and an F12 check for absent HTTP requests.
- What you can do after
- Apply it via jQuery Validation and jQuery Validation Unobtrusive to display form errors without submitting invalid data.
Read how Pro ASP.NET Core 7, Tenth Edition explains data-val-* attribute →
ASP.NET Core in Action, 3e
A data-val-* attribute is an HTML attribute convention that encodes validation metadata for unobtrusive client-side validation libraries.
- How it is used
- Supports unobtrusive client-side validation by carrying DataAnnotations constraints from generated form fields to JavaScript libraries.
- How deep it goes
- Explains generated validation attributes and required scripts, but does not descend into library internals or custom rule implementation.
- Examples
- Shows an email input with data-val-email and data-val-required metadata, plus script references for unobtrusive validation.
- What you can do after
- Apply it via generated form markup and validation libraries to provide immediate feedback for invalid field values.
Read how ASP.NET Core in Action, 3e explains data-val-* attribute →
What to know first
- validationValidation is the process of checking data, behavior, or results against defined criteria to determine their correctness, acceptability, or suitability for a purpose.
Related concepts
- dataannotations attributeproduced by · A DataAnnotations attribute is a .NET attribute that declares metadata or validation rules for types, members, and data-model elements.
- attributekind of · An attribute is a named property or piece of information associated with an entity, object, or structured data item.
- unobtrusive validationused by · Unobtrusive validation is a client-side validation approach that represents rules in HTML data attributes and processes them through separate scripts.
- validationuses · Validation is the process of checking data, behavior, or results against defined criteria to determine their correctness, acceptability, or suitability for a purpose.
Questions about data-val-* attribute
What is data-val-* attribute?
A data-val-* attribute is an HTML data attribute convention for encoding validation metadata used by unobtrusive client-side validation.
Which Manning books explain data-val-* attribute?
Pro ASP.NET Core 7, Tenth Edition and ASP.NET Core in Action, 3e.
What should I know before learning data-val-* attribute?
Manning books that teach data-val-* attribute usually introduce validation first.
What kinds of data-val-* attribute are there?
Kinds of data-val-* attribute include data-val-required attribute.
What is data-val-* attribute a kind of?
Data-val-* attribute is a kind of attribute. An attribute is a named property or piece of information associated with an entity, object, or structured data item.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

