Closed RichardBr closed 3 years ago
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.
This has nothing to do with the .NET runtime/corelib and should be moved to dotnet/aspnetcore.
This has nothing to do with the .NET runtime/corelib and should be moved to dotnet/aspnetcore.
Yes your right. How do you move this to aspnetcore?
I have moved the issue to aspnetcore (#30740)
Description
The issue is I'm not able to get a validation message to show against a field. Although the error message does appear in the validation summary.
This issue is also further restricted to only complex model properties. The approach of using "ValidateComplexType", "ObjectGraphDataAnnotationsValidator" to resolve complex model property validation limitation does not help in this instance.
The sample code below which I have created to demonstrate the problem is virtually ALL code from the Microsoft docs website (https://docs.microsoft.com/en-us/aspnet/core/blazor/forms-validation). I have attached the complete source code solution BlazorTest1.zip. Simply rebuild the solution and run to test.
New Ship Entry Form
Captain's Name
@message
Star Trek, ©1966-2019 CBS Studios, Inc. and Paramount Pictures
@code { private bool disabled; private string message; private string messageStyles = "visibility:hidden"; private CustomValidator customValidator; private Starship starship = new Starship() { ProductionDate = DateTime.UtcNow };
}
using System; using System.ComponentModel.DataAnnotations;
namespace BlazorTest1.Client.Shared { public class Starship { [Required] [StringLength(16, ErrorMessage = "Identifier too long (16 character limit).")] public string Identifier { get; set; }
}
namespace BlazorTest1.Client.Shared { public class PersonsName { public string Firstname { get; set; } public string Lastname { get; set; } } }