Open ljfio opened 2 years ago
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.
Is there an existing issue for this?
Is your feature request related to a problem? Please describe the problem.
I would like to be able to handle events if the validation state has changed for a single
FieldIdentifier
Describe the solution you'd like
It would make most sense to add the
FieldIdentifier
to theValidationStateChangedEventArgs
that could be set whenever theNotifyValidationStateChanged
method on theEditContext
is invoked with aFieldIdentifier
The default behaviour could still be an empty event for the whole model but it would be fantastic if you could pass in a range of or an individual
FieldIdentifier
In the
EditContext
:And the
ValidationStateHasChangedEventsArgs
being updated to include an additional constructor to take in theFieldIdentifier
:Additional context
I believe this will improve performance of handling the
OnValidationStateChanged
events by allowing components / code that hooks onto these events to filter whether it needs to process this event or not.In my application I am hooking into the
OnFieldChanged
andOnValidationRequested
to useFluentValidation
to update theEditContext
with my validation rules then calling theNotifyValidationStateHasChanged
. In the instance of just handling field changes, I think it makes sense to notify that validation for that (or dependent fields I am aware of) are only notified of the validation state changed. Across my form I have implemented a custom component that displays my validation message for the component it is associated.This could also be used to enhance the
Microsoft.AspNetCore.Components.Forms.ValidationMessage
component by only handling changes when the whole form is updated or just the individual field.