Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Populating Dropdown fields in dialog.xml

Avatar

Level 2

I have various different dropdown fields in my dialog.xml that i fill by calling a servlet using the options tag and then using the options root to say which JSONArray I want. This works well, however the same servlet calls an outside source and makes all of the JSONArrays so by having the options and options root on all nine of my drop downs it ends up calling the servlet nine times so it takes forever to load. Is there a way to call this servlet once, maybe in the root, and then access it by passing which options root i want in each dropdown?

ex.

<productsValue

            jcr:primaryType="cq:Widget"

            emptyText="Please Select..."

            fieldLabel="Property Value"

            name="./productsValue"

            options="path/to/servlet.json"

            optionsRoot="products"

            type="combobox"

            xtype="selection">

    </productsValue>

1 Accepted Solution

Avatar

Correct answer by
Level 10

1. You can use this optionsProvider  property to return your JSON data

2. Do not make 9 servlet calls, make 1 and store data in browser localstorage.

3. before next request check localstorage, if data is there use optionsProvider  

View solution in original post

3 Replies

Avatar

Level 10

You should be able to handle it using JS and listeners.

Avatar

Level 2

I am currently using listeners to do other things such as only showing a certain dropdown when the correct value in the top dropdown is selected. How would i go about achieving this functionality using js and listners?

Avatar

Correct answer by
Level 10

1. You can use this optionsProvider  property to return your JSON data

2. Do not make 9 servlet calls, make 1 and store data in browser localstorage.

3. before next request check localstorage, if data is there use optionsProvider