Expand my Community achievements bar.

SOLVED

Programmatically adding Dropdown values do not show up for content fragments

Avatar

Level 3

I created a drop down dialog for a content fragment 

ui.content/src/main/content/jcr_root/conf/aem-test/settings/dam/cfm/models/test/.content.xml

 

 <color jcr:primaryType="nt:unstructured"
                                listOrder="24"
                                valueType="string"
                                showEmptyInReadOnly="true"
                                metaType="enumeration"
                                required="on"
                                name="color"
                                fieldLabel="Color"
                                emptyOption="true"
                                sling:resourceType="granite/ui/components/coral/foundation/form/select"
                                renderReadOnly="false">
                            <optionsMultifield jcr:primaryType="nt:unstructured">
                                <item0 jcr:primaryType="nt:unstructured"
                                       fieldLabel="Error"
                                       fieldValue="error"/>
                                <item1 jcr:primaryType="nt:unstructured"
                                       fieldLabel="Warning"
                                       fieldValue="warning"/>
                                <item2 jcr:primaryType="nt:unstructured"
                                       fieldLabel="Notification"
                                       fieldValue="notification"/>
                            </optionsMultifield>
                            <granite:data jcr:primaryType="nt:unstructured" />
                        </color>

 

 

 

But when building and loading the cfm the dropdown is empty

goonmaniangooner_0-1659032136686.png

There are no visible errors in the browser or in the error.log except for a warning

 

28.07.2022 11:15:22.354 *WARN* [[0:0:0:0:0:0:0:1] [1659032122149] GET /editor.html/content/dam/test/content-fragments/test HTTP/1.1] org.apache.jackrabbit.oak.plugins.index.lucene.LucenePropertyIndex This index is deprecated: /oak:index/lucene; it is used for query Filter(query=select [jcr:path], [jcr:score], * from [nt:base] as a where contains(*, '"/content/dam/test/content-fragments/test"') /* xpath: //*[jcr:contains(., '"/content/dam/test/content-fragments/test"')] */ fullText="/content/dam/test/content-fragments/test", path=*). Please change the query or the index definitions.

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

There is no extensibility in content fragments to create dynamic drop-downs. Fields are limited and no Api is there to customize fields. But you can overlay the jsp script used to generate the dropdown options from static list. Overlay 

/libs/dam/cfm/admin/components/datasources/optionrenderer/optionrenderer.jsp

and try. Hope this helps! 

View solution in original post

2 Replies

Avatar

Community Advisor

Dynamic data in dropdown for Content Fragment is not possible OOTB as per this blog :
https://blogs.perficient.com/2019/09/06/dynamic-dropdowns-in-aem-content-fragments/

 

@goonmanian-gooner  Did you try customizing as explained in the blog?

Avatar

Correct answer by
Community Advisor

There is no extensibility in content fragments to create dynamic drop-downs. Fields are limited and no Api is there to customize fields. But you can overlay the jsp script used to generate the dropdown options from static list. Overlay 

/libs/dam/cfm/admin/components/datasources/optionrenderer/optionrenderer.jsp

and try. Hope this helps!