Anonymous ValidationMessages #78
Replies: 2 comments
-
Hi Chris, I don't think this is possible with Blazor's forms and validation system as-is. I think the key part is the Validation Store, it holds a key which corresponds to a property on the form model and a list of errors for that key. The issue with what you're attempting is that there would be an error but it wouldn't belong to anything. |
Beta Was this translation helpful? Give feedback.
-
Cheers Chris, I guess that's what I am after then really, being able to filter out the messages that don't belong to anything and show them at the start. I guess that might be possible somewhere? Either way I think this falls under an |
Beta Was this translation helpful? Give feedback.
-
This is a crude example but:
The first rule is specific to a field of a command (Title) so in the front end I show this by using
<ValidationMessage For="() => Command.Title" />
The second rule is NOT specific to a field so I would like to display it at the top of the form, is there a way to do this?
Initial thoughts were I could do something like
<ValidationMessage For="() => Command" />
because it matches the Expression of the rule. That didn't work.My second thought was to use
<ValidationSummary/>
however, this shows all of the errors, I just want to show "unlinked" errors at the top of the form.Any ideas?
Thanks again
Chris
Beta Was this translation helpful? Give feedback.
All reactions