Populating Dropdown fields in dialog.xml | Community
Skip to main content
knicksak2
Level 2
February 12, 2016
Solved

Populating Dropdown fields in dialog.xml

  • February 12, 2016
  • 3 replies
  • 922 views

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>

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by edubey

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  

3 replies

Lokesh_Shivalingaiah
Level 10
February 12, 2016

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

knicksak2
knicksak2Author
Level 2
February 12, 2016

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?

edubey
edubeyAccepted solution
Level 10
February 13, 2016

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