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?
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.
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.
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. It would be nice to get this fixed in the base class.
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.