RadzenRequiredValidator with Custom Components

Hello community!

I wanted to ask if the Required Validator can work with Custom Non-Radzen components? I have a situation where i have developed a two-way binding component which works great on Forms, grids, and also inline editing inside Radzen, but i tried to setup a RequiredValidator and set the name property properly in both spots but the Validator isnt triggered.

Does anyone have any knowledge on this or if this is possible?

TIA!

You can try inheriting from the Radzen.FormComponent<T> class.

@korchev,

I have tried this and it will then allow the component to be verified but the ValueChanged functions stop working and on inline edit, when you update the value, it reverts back to the original version. Do you have an idea why this would happen?

When i do not include @inherits Radzen.FormComponent to the top all functions work except validation. When i do inherit, then only the validation works.

Here is a minimal working implementation:

@inherits FormComponent<string>
<input value="@Value" @onchange="@OnChange" />
@code {
    protected async Task OnChange(ChangeEventArgs args)
    {
       Value = args.Value;

       await ValueChanged.InvokeAsync(Value);

       if (FieldIdentifier.FieldName != null) 
       { 
           EditContext?.NotifyFieldChanged(FieldIdentifier); 
       }
       
       await Change.InvokeAsync(Value);
    }
}

This helped me alot! Thanks a bunch!