Automatically filled city name by zip code

Dear Radzen Team,

I want a ZIP form field and when the user start to type it and it length reaches 4 length the code automatically get its city name from database.

  • only digits,
  • max 4 digits and the field noesn't allow more.

I tried RadzenNumeric field but it allows more digits than what is set in Max property and after changing the focus from field evaluates its chack.

I tried RadzenTextBox but I cannot disallov letters in it.

I tried RadzenMask but the @oninput eventhandler doesn't work. It doesn't call the eventhandler method.

Can you help me, please?

Max for Numeric is a number not maximum characters.

You can with additional code:

Dear enched,

Thank you very much for help.
Unfortunatelly, somehow it doesn't work for me:

<RadzenTextBox MaxLength="4" Placeholder="" Name="Zip" @bind-Value="@(City!.Zip)" Style="width: 100%;display: block" class="w-100" @oninput="@(args => this.City.Zip= new string(args.Value.ToString().Where(p => char.IsDigit(p)).ToArray()) )" />

When I change .Where(p => char.IsDigit(p)).ToArray() for .ToUpper() is it Ok, but otherwise it doesn't work.

I know it is not a Radzen Blazor problem but if you have any advise, please.