내 커뮤니티 업적 표시줄을 확대합니다.

Submissions are now open for the 2026 Adobe Experience Maker Awards.

Mark Solution

활동이 없어 이 대화는 잠겼습니다. 새 게시물을 작성해 주세요.

해결됨

Restrict the asset details to get saved

Avatar

Level 2

i created a custom field in metadata schema. This field have validation like starts with capital M,S and follow with numeric (ex:MS123 accepted Ms234 error).

This field is not a required fields. if the user don't input any data it should save. if the user input some data/text and the data not follows the patten then we need to restrict the user in saving the asset details.

 

Please help...

 

1 채택된 해결책 개

Avatar

정확한 답변 작성자:
Level 2

Hi,

i checked on the html of every field. i found a difference if field have validation and we input the incorrect text/data this 

aria-invalid="true"

will append to the html. i used aria-invalid attribute whenever if aria-invalid="true" the save&close/save should highlight error and should not perform save operation.

원본 게시물의 솔루션 보기

5 답변 개

Avatar

Level 5

Hi @mahi1365 ,

 

For validation of the schema fields you can use the foundation validation API and add a regex pattern to validate your requirement.

Try the regex below for your requirement

 

^$|^MS+([\d])*$

 

 

https://medium.com/@theopendle/aem-custom-metadata-forms-for-assets-8c6597205f9d  

 

Hope this helps.

Avatar

Level 2

validation is working fine. the field is not a required field. but when ever user enters wrong pattern  it should restrict the user from saving.

 

 

Avatar

Level 5

^$|^MS+([\d])*$

 

In the above pattern the first part ^$ allows empty string, so empty value will allow saving and second part allows only the pattern, so wrong pattern will restrict the user from saving.

Avatar

Employee Advisor

@mahi1365 on submit/save event you can run a validation check for all the not null fields against their regex pattern and if anything is found to be false then set the focus to the respective with the error at the widget.

Avatar

정확한 답변 작성자:
Level 2

Hi,

i checked on the html of every field. i found a difference if field have validation and we input the incorrect text/data this 

aria-invalid="true"

will append to the html. i used aria-invalid attribute whenever if aria-invalid="true" the save&close/save should highlight error and should not perform save operation.