Additional validation messages in ValidationMessage component #250
-
I'm using Blazored.FluentValidation with .NET 8 and am having an odd issue where the validation message I assigned to a rule appears as well as a separate message. I think the additional message is from built-in EditForm validation. The highlighted messages aren't from the validator class, and the message from the validator isn't shown for the InputSelect component. I initially thought that the issue was caused by validation attributes for the properties in addition to the validation class, so I removed all validation attributes. This didn't fix the issue. I then looked at the form in this repository's sample code and updated mine to match. This also didn't fix the issue. After the changes the main difference I see between my form and the sample one is that my form uses an EditContext instead of a Model. This is due to my form needing to be able to edit an existing item in addition to creating a new item. I'm not sure if using EditContext versus Model is causing the problem or not. Since the code I am using belongs to my employer I'll work on a repository that demonstrates the issue that is safe to release. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I created a repository that demonstrates the issue, and it also occurs using Model in the EditForm. https://github.com/brian-aisin/ValidationMessageIssueDemo |
Beta Was this translation helpful? Give feedback.
-
It appears the cause of the issue is the NotNull() rule in addition to the NotEmpty() rule. I removed the NotNull() rule and now one validation message appears per form input. |
Beta Was this translation helpful? Give feedback.
It appears the cause of the issue is the NotNull() rule in addition to the NotEmpty() rule.
I removed the NotNull() rule and now one validation message appears per form input.