AD B2C - 为每个字段自定义必填字段消息

问题描述 投票:0回答:2

我正在尝试更改必填字段的错误消息,截至目前它显示所有字段的常见错误消息。

但我希望每个字段都有不同的消息。

我尝试过本地化,但无法设置每个字段的配置。下面为所有字段设置相同的消息。

<LocalizedString ElementType="UxElement" StringId="required_field">Value is required.</LocalizedString>

您能否建议在 AD B2C 自定义策略中处理这种情况的方法?

或者我可以在自定义 HTML 模板中使用 jQuery 做些什么来更改错误消息吗?

jquery localization azure-ad-b2c azure-ad-b2c-custom-policy validationmessage
2个回答
1
投票

https://learn.microsoft.com/en-us/azure/active-directory-b2c/localization-string-ids#sign-up-and-self-asserted-pages-example

 <LocalizedString ElementType="ErrorMessage" StringId="UserMessageIfMissingRequiredElement">Missing required element: {0}</LocalizedString>

{0} 将动态使用声明显示名称。

"error_requiredFieldMissing”
可以另外使用。


0
投票

您需要将

pagelayout(DataUri)
版本升级到最新版本。

<ContentDefinition Id="api.localaccountsignup">
  <LoadUri>https://example.com/selfAsserted.html</LoadUri>
  <RecoveryUri>~/common/default_page_error.html</RecoveryUri>
  <DataUri>urn:com:microsoft:aad:b2c:elements:contract:selfasserted:2.1.26</DataUri>
  <Metadata>
    <Item Key="DisplayName">Local account sign up page</Item>
  </Metadata>
</ContentDefinition>

然后

required_field_descriptive
可以用于本地化。

© www.soinside.com 2019 - 2024. All rights reserved.