Open Closed

Blazor client side validation without Blazorise #1874


User avatar
0
stjepanh_teched created
  • 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 Answer(s)
  • User Avatar
    -1
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

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

Made with ❤️ on ABP v9.1.0-preview. Updated on December 05, 2024, 12:19