Asynchronous Validation

I am inspecting the ValidatorBase but it does not seem to support asynchronous validation. In my case I would like to check with a service to see that a value is unique and has not already been provided.

Is there a recommended guidance/strategy for accomplishing this?

Hi @DragonSpark,

Indeed the Radzen Validator components do not support asynchronous validation at the moment. In fact no custom validation methods are supported. This is something we will probably add in a future release.

1 Like

Great, thanks for the information/confirmation, @korchev. FWIW, I found this article and it has helped put me on the right path. Maybe it will assist for others, as well:

Additionally, if I end up writing anything of interest I will share it here as well. :+1:

Alright, made some progress here.

One thing I did want to mention is that it seems there is a bug with the RadzenTemplateForm when the EditContext changes. The added components are still left within the form's component collection and are never cleared. I am working around this with the following implementation:

	public class Form<TItem> : RadzenTemplateForm<TItem>
	{
		readonly static FieldInfo FieldInfo = typeof(RadzenTemplateForm<TItem>)
			.GetField("components", BindingFlags.Instance | BindingFlags.NonPublic);

		readonly FieldInfo _field;

		[UsedImplicitly]
		public Form() : this(FieldInfo) {}

		public Form(FieldInfo field) => _field = field;

		protected override void OnParametersSet()
		{
			var context = EditContext;
			base.OnParametersSet();
			if (context != null && context != EditContext)
			{
				_field.GetValue(this)
				      .To<List<IRadzenFormComponent>>()
				      .Clear();
			}
		}
	}

Kinda hacky tho. :grin: It would be nice to get this fixed in the base class. :+1:

Speaking of which, is this project on GitHub? I was surprised to see the blazor.radzen.com GitHub point to the site's source. This is cool of course but it would be nice to contribute/see the code for the Radzen.Blazor project as well.

It would be nice to get this fixed in the base class.

I couldn't understand what the actual problem is.

Speaking of which, is this project on GitHub?

Radzen.Blazor is not an open source project and its source isn't available.