Expand my Community achievements bar.

SOLVED

Is there a way to restrict the typed value for the Metadata Field with tagfield resourceType?

Avatar

Level 2

Hi,

 

Is there a way to restrict the users from having hand-typed values for the field with tagfield resourceType?

 

As shown below in the screenshot, the value for the Tags field has two values. "Typed" is the value being hand-typed whereas "Asset Properties: Orientation / Landscape" is the value being selected from the tags screen after clicking the check mark button.

In the below screenshot, I would like to restrict "Typed" value and allow the selected "Asset Properties: Orientation / Landscape" value.

 

-Anish

 

Snag_f3c21d6.png

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @anish11,

In general you can't do this from GUI. However this can be done other way.

First of all Tags filed is using cq/gui/components/coral/common/form/tagfield, which provides below property, that could be useful in your case.

  • forceSelection by default this property is not set, which means that author can either select or enter value
    tagfield.jpg
    You can find full implementation under /libs/cq/gui/components/coral/common/form/tagfield/render.jsp

How you can utilize above in your scenario. Assuming you are using OOTB asset schema but it will be similar if you have custom one), you will needed to edit default schema and save it, no changes are required. As a result under /conf proper definition representing default schema will be created. To be more precise you will find it under /conf/global/settings/dam/adminui-extension/metadataschema/default, next you have to look for node that represents Tags input and add forceSelection property with value true.

custom-schema.jpg

That's all, from now user will be able only to select tags, and even if he/she will type value it will not be saved as a tag.

View solution in original post

3 Replies

Avatar

Community Advisor

You can only control the rootpath to allow selection inside certain paths using rootpath property using docs https://developer.adobe.com/experience-manager/reference-materials/6-5/granite-ui/api/jcr_root/libs/... if your use case is to only allow one as default you can use metadata profile available for asset metadata  https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/assets/manage/metad...

Avatar

Correct answer by
Community Advisor

Hi @anish11,

In general you can't do this from GUI. However this can be done other way.

First of all Tags filed is using cq/gui/components/coral/common/form/tagfield, which provides below property, that could be useful in your case.

  • forceSelection by default this property is not set, which means that author can either select or enter value
    tagfield.jpg
    You can find full implementation under /libs/cq/gui/components/coral/common/form/tagfield/render.jsp

How you can utilize above in your scenario. Assuming you are using OOTB asset schema but it will be similar if you have custom one), you will needed to edit default schema and save it, no changes are required. As a result under /conf proper definition representing default schema will be created. To be more precise you will find it under /conf/global/settings/dam/adminui-extension/metadataschema/default, next you have to look for node that represents Tags input and add forceSelection property with value true.

custom-schema.jpg

That's all, from now user will be able only to select tags, and even if he/she will type value it will not be saved as a tag.

Avatar

Level 2

Thanks @lukasz-m. This exactly solved my use case.

Also do you mind sharing the link for the online documentation on the tagfield that you have mentioned under /libs/cq/gui/components/coral/common/form/tagfield/render.jsp please?