I have a dropdown field in the metadata schema editor and I want the options of this dropdown to be populated dynamically from a servlet response. I am following below guide to achieve it. There is a question around my requirement and from the author's answer it seems just pointing the JSON path to the servlet should help achieve it. Has anybody come across this before? Do you know if it works coz I have not been able to achieve it. If i point the JSON path to an nt:file it works.
Using a JSON file with the Dropdown widget on the Metadata Schema | Content Management
Options array from the servlet or in the JSON file
{
"options": [
{
"value": "en-gb",
"text": "English-United Kingdom"
},
{
"value": "en-us",
"text": "English-United States"
},
{
"value": "fr-ca",
"text": "French-Canada"
},
{
"value": "fr-fr",
"text": "French-France"
},
{
"value": "de-de",
"text": "German-Germany"
},
{
"value": "es-mx",
"text": "Spanish-Mexico"
},
{
"value": "es-es",
"text": "Spanish-Spain"
}
]
}
JSON path value - /etc/tags/custom/industries.options.json
Views
Replies
Total Likes
You can populate a GRANITE Select with a Sling Servlet. Is this dropdown a Granite Select field?
Views
Replies
Total Likes
It's in the asset metadata schema not in a component.
Not sure if this is what you're talking about but it could be in a Show/Hide that's in the standard library. Here's a video on this FWIW.
D
Hi, I am replying on an old thread. But I had the similar problem and not found any solution so tried some custom approach and able to achieve this.
Solution:
1. overlay/customise default metadataschema using metadataschema editor.(http://www.sgaemsolutions.com/2017/02/overrideoverlay-dam-asset-metadata-in.html )
2. Add custom dropdown field using datasource object to populate dropdown.
For Example: I have added below dropdown in my metadataschema dialog xml to dynamically populate dropdown from my servlet
<_x0031_612365521559 jcr:primaryType="nt:unstructured" sling:resourceType="dam/gui/components/admin/schemafield" emptyText="Select Option" fieldLabel="Collections" name="./jcr:content/metadata/test" resourceType="granite/ui/components/coral/foundation/form/select"> <granite:data jcr:primaryType="nt:unstructured" choicesCascading="default" cq-msm-lockable="./metadata/test" metaType="dropdown" requiredCascading="default" visibilityCascading="default"/> <datasource jcr:primaryType="nt:unstructured" sling:resourceType="<servlet resourceType>" addNone="{Boolean}true"/> <cascadeitems jcr:primaryType="nt:unstructured" sling:resourceType="dam/gui/coral/components/admin/schemaforms/formbuilder/cascadeitems"/> </_x0031_612365521559>
Views
Likes
Replies
Views
Likes
Replies