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}"
Thank you in advance
Yes, but i would like to set my own DTOs here: AbpCrudPageBase<IIdentityUserAppService, IdentityUserDto, Guid, GetIdentityUsersInput, IdentityUserCreateDto, IdentityUserUpdateDto>
Thank you for your help, now it works. Is it possible for this component to inherit AbpCrudPageBase so I can inject my custom types?
I've managed to make a custom component by the code you provided, but I can't get pass the exception "CustomUserManagement is not assignable to service Volo.Abp.Identity.Pro.Blazor.Pages.Identity.UserManagement".
I also tried to do the most simple case - basic component with plain html just to try replacing the UserManagement, but I get the same exception. This is the basic component:
@page "/identity/users"
@using Volo.Abp.Identity
@inherits AbpCrudPageBase<IIdentityUserAppService, IdentityUserDto, Guid, GetIdentityUsersInput, IdentityUserCreateDto, IdentityUserUpdateDto>
@attribute [Volo.Abp.DependencyInjection.ExposeServices(typeof(Volo.Abp.Identity.Pro.Blazor.Pages.Identity.UserManagement))]
@attribute [Volo.Abp.DependencyInjection.Dependency(ReplaceServices = true)]
<h3>TestUserManagement</h3>
What am I doing wrong?
Is it possible to change existing property visibility on the UI? We've followed the instructions in the ModuleExtensionConfigurator - configuring visibility of the new properties works but configuring existing (predefinied) properties doesn't. Example:
You need custom the UI, see https://docs.abp.io/en/abp/latest/UI/Blazor/Customization-Overriding-Components , I can send you the UI source code if you need.
Can you please send the source code so we can fix it quicker?
The extended UI does not support client-side validation.
By overriding the UI, I can also get the client side validation? If that is correct, can you please also provide source code of the Identity module Edit modal?
Thank you very much for your help.
Is it possible to remove existing property from identity module? For example, we don't need phone number property in our project, how can we remove it?
You can download the module source code to customize, but we do not recommend it.you can just ignore it
How to remove it than from the UI? Third item in original question is dealing with that question.
How to enable client side validation for the property? We've set required attribute with the following: property.Attributes.Add(new RequiredAttribute());
What UI are you using?
We are using Blazor UI.
Hi,
I have couple of questions regarding the abp commercial identity module extensibility:
user.AddOrUpdateProperty<string>(
"Surname",
property =>
{
property.UI.OnTable.IsVisible = false;
}
);
How to set new property as required in database?
How to enable client side validation for the property? We've set required attribute with the following:
property.Attributes.Add(new RequiredAttribute());
But only server side validation works (modal window pops up if field is empty) - is it possible to enable client side validation for new properties?
Same goes for field length. We have set the following in ModuleExtensionConfigurator:
property.Attributes.Add(new MaxLengthAttribute(UserConsts.MaxTitleLength));
But only the server side validation is triggered.
Thank you in advance, Hrvoje