Aperto Chiuso

Blazor client side validation without Blazorise #1874


User avatar
0
stjepanh_teched creato
  • ABP Framework version: v4.4.2.
  • UI type: Blazor
  • DB provider: EF Core

Hello, we are trying to localize the deafult messages from data annotation validation attributes on the client side. Using Blazorise validation works, but we've opted to use Blazor form elements. Is it possible to make localization work in that context? Basic example:

Component.razor:

        <EditForm Model="model" OnValidSubmit="SubmitAsync">
            <DataAnnotationsValidator />
            <InputText id="name" @bind-Value="model.Test" />
            <ValidationMessage For="() => model.Test" />
            <Button Type="ButtonType.Submit">Button</Button>
        </EditForm>

Model DTO:

    public class TestDto
    {
        [Required(ErrorMessage = "Required1"]
        public string Test { get; set; }
    }

We've added key-value pair in en.json: "Required1": "test test {0}"

This is the result: Any help?

Thank you in advance


1 risposte
  • User Avatar
    -1
    liangshiwei creato
    Team di supporto Fullstack Developer

    Hi,

    This is a feature of blazorise, you should keep use blazorise element.

Made with ❤️ on ABP v8.2.0-preview Updated on marzo 25, 2024, 15:11