Closed juliushuck closed 4 years ago
Do your properties have RequiredAttribute
? Most data annotations validations do not execute if the value is null:
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.
See our Issue Management Policies for more information.
No they are custom attributes. The standard ones are working. But I'm checking for null and the required type
If it works with regular validation attributes, do you think there's an issue with how you've authored the attributes. If you don't think this is an issue with your code, could you share a minimal app that reproduces this issue?
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.
See our Issue Management Policies for more information.
Describe the bug
Asp.Net Core Blazor WASM
I created a custom validation attribute and overridden the IsValid function. The validation summary shows me the error message correctly but the validation message does not show the error. And the textbox is getting green. It is working for standard validation attributes.
I discovered a strange behavior. When I open the page and submit the empty form, No error is shown in the validation message. When I fill in sth wrong and submit it, it submits valid. When I remove the data and submit, it does not submit valid and shows me the correct errors. When I click submit again on the empty form the errors are hidden and the textbox is green but the form does not get submitted valid.
Further technical details
.NET Core SDK (reflecting any global.json): Version: 3.1.101 Commit: b377529961
Runtime Environment: OS Name: Windows OS Version: 10.0.18363 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\3.1.101\
Host (useful for support): Version: 3.1.1 Commit: a1388f194c
.NET Core SDKs installed: 3.1.101 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
To install additional .NET Core runtimes or SDKs: https://aka.ms/dotnet-download
Rider by JetBrains Windows