React to feedback

pull/4363/head
Luke Latham 2017-09-27 14:58:13 -05:00
parent 139b95ff04
commit f76aa0bd2d
1 changed files with 2 additions and 2 deletions

View File

@ -63,11 +63,11 @@ Non-nullable [value types](/dotnet/csharp/language-reference/keywords/value-type
MVC model binding, which isn't concerned with validation and validation attributes, rejects a form field submission containing a missing value or whitespace for a non-nullable type. Model binding usually ignores missing data for non-nullable types, where the form field is absent from the incoming form data.
Client-side validation always requires a value for a form field that corresponds to a C# property marked `Required`. `Required` can be used to control the client-side validation error message.
Client-side validation requires a value for a form field that corresponds to a model property that you've marked `Required` and for a non-nullable type property that you haven't marked `Required`. `Required` can be used to control the client-side validation error message.
The [BindRequired attribute](/aspnet/core/api/microsoft.aspnetcore.mvc.modelbinding.bindrequiredattribute) (also see [Customize model binding behavior with attributes](xref:mvc/models/model-binding#customize-model-binding-behavior-with-attributes)) is useful to ensure form data is complete. When applied to a property, the model binding system requires a value for that property. When applied to a type, the model binding system requires values for all of the properties of that type.
When you create a [Nullable\<T> type](/dotnet/csharp/programming-guide/nullable-types/) from a value type (for example, `decimal?` or `System.Nullable<decimal>`) for a property of a model and mark it `Required`, a server-side validation check is performed as if the property were a standard nullable type (for example, a `string`).
When you use a [Nullable\<T> type](/dotnet/csharp/programming-guide/nullable-types/) (for example, `decimal?` or `System.Nullable<decimal>`) and mark it `Required`, a server-side validation check is performed as if the property were a standard nullable type (for example, a `string`).
## Model State