Validation Messages

Hi,

I'm using the CustomValidator component, but I want to dynamically set the error message, not hard code it on the Text= parameter. So, I'm setting Text=@ORG_CodeError, and in the validation function I set ORG_CodeError to whichever message I need. This all works well; my message shows in the validatior below to field in question, however, I also have a ValidationSummary component showing, and this shows a blank message the first time validation is performed, thereafter it catches up?

Cheers
Reg

Setting the message in the validation function isn't a supported scenario. Just use more than one validator.

Will do, although it does work if you're not using the ValidationSummary tag...

Hi

Your own validators use the standard Blazor messagestore as I understand it. Is this messagestore available to me in code? Sp that I could manually add more messages to it?

No, the message store is created within the validator and not exposed to external usage. I think I've linked the source code in your other thread.

Ok, it would be useful I think, to be able to add messages to that store, or at least to be able to read the messagestore. Could that be considered?

We advise our users to use the validation components instead of the Blazor validation API directly. If you want the latter you can do so by using the API yourself. We don't plan to expose the message store of the validator itself. You can easily create one yourself and populate it as you see fit. You can access the EditContext by injecting it in your component.

So basically, I should either only use the validation components, or not use them at all and use the standard Blazor EditContext structure.

Ok, thanks korchev

The Radzen validation components use the built-in validation infrastructure (based on EditContext) as well. So yes - at the end of the day it is all handled there.