Open VictorioBerra opened 1 month ago
Thinking on this more, I think this amounts to a feature request:
.PreValidate()
and .PostValidate()
you could even leave .PreValidate()
as .Validate()
to be backwards compatible.
Thoughts?
Hi - thanks for raising this and illustrating it with an example. I can absolutely see how it might be useful to have the field validation run first, and then stop if there is an error. If I recall correctly, my intention with running the global validation first had been to allow a quick check for access rights.
Perhaps an overload to Editor.Validate()
to tell it to run the validator after the fields (or not - default) might be the way to do this, or an Editor.ValidateAfterFields()
(ugly!) method.
I'll set a 2.4 target for this as I think it would be a good addition.
An overload would be awesome! Thanks Allan
On Wed, Jul 17, 2024, 10:22 AM Allan Jardine @.***> wrote:
Hi - thanks for raising this and illustrating it with an example. I can absolutely see how it might be useful to have the field validation run first, and then stop if there is an error. If I recall correctly, my intention with running the global validation first had been to allow a quick check for access rights.
Perhaps an overload to Editor.Validate() to tell it to run the validator after the fields (or not - default) might be the way to do this, or an Editor.ValidateAfterFields() (ugly!) method.
I'll set a 2.4 target for this as I think it would be a good addition.
— Reply to this email directly, view it on GitHub https://github.com/DataTables/Editor-NET/issues/26#issuecomment-2233586088, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAWMN2ZQENFZW5MIRBGHBALZM2D4FAVCNFSM6AAAAABLAYJ6L6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMZTGU4DMMBYHA . You are receiving this because you authored the thread.Message ID: @.***>
Maybe im approaching this wrong but I have a global validator that needs to do some special custom checks.
Because my global validator runs first im duplicating a ton of field validators:
Now this would be my code if I could trust that field validators all ran and that it was safe to access my dictionary:
Looking at the code looks like PreX events run before field validation too... so those are not a workaround for me either.