Customizing validation for asset metadata fields

Avatar

Avatar

davidm28404065

Avatar

davidm28404065

davidm28404065

08-11-2019

I'm trying to customize the validation for a couple of Asset Metadata fields. I need to make the Title and Description required. I also need to implement additional restrictions on the field values (no capital letters, no blank spaces, etc..., but I could do that on the js file). I have a few questions:

1) Why is my overlay attempt not working? (summary of what I did to follow)

2) What is the location of the javascript files that manage those fields? I wish to implement the rest of the validation there but I can't seem to find the appropriate files to edit and overlay. As a follow up, what is the recommended way to find the client side code under libs. I'm a backend dev with limited front end experience. I can work with the browser dev tools, but I often feel like I'm going through a wild goose chase.

I am able to make the fields required by adding the required parameter in the following nodes under libs

/libs/dam/content/schemaeditors/forms/default/items/tabs/items/tab1/items/col1/items/title

/libs/dam/content/schemaeditors/forms/default/items/tabs/items/tab1/items/col1/items/description

However, I when I attempted to overlay those nodes under apps I was not successful, the fields go back to not being required. I recreated the following nodes, including the required="{Boolean}true" parameter, and deleting the parameter from the nodes under libs since the ones under apps should take precedence.

/apps/dam/content/schemaeditors/forms/default/items/tabs/items/tab1/items/col1/items/title

/apps/dam/content/schemaeditors/forms/default/items/tabs/items/tab1/items/col1/items/description

cow_editing.png

required_field.png

Any help will be much appreciated

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

Theo_Pendle

MVP

Avatar

Theo_Pendle

MVP

Theo_Pendle
MVP

10-11-2019

Hi David,

I used your problem as inspiration for this tutorial: https://medium.com/@theopendle/aem-custom-metadata-forms-for-assets-8c6597205f9d

With regards to your question about the failed overlay, its because that part of /libs is protected. You can read about it here but basically everything under /libs/dam/content/schemaeditors is marked with the granite:InternalArea mixin type, meaning it cannot be overlaid or overriden.

The good news is that as a rule of thumb, I've found that whenever I was prevented from doing what I want because of this issue, it usually means there is a more "standard" way to approach the problem (not always though, I'll admit)

Answers (2)

Answers (2)

Avatar

Avatar

Theo_Pendle

MVP

Avatar

Theo_Pendle

MVP

Theo_Pendle
MVP

11-11-2019

Hi sunjot16,

I'm sorry but I think this is completely the wrong approach If you'd like to discuss it, feel free to send me a message (so as not to pollute this thread).

Avatar

Avatar

sunjot16

Employee

Avatar

sunjot16

Employee

sunjot16
Employee

11-11-2019

Copy the entire schemaeditors node in libs and paste it under apps in the same location as it exists in libs, then try to make the changes to the items in the apps' schemaeditors/...