Populate Touch UI dropdown dynamically from sling servlet response. | Community
Skip to main content
Level 2
January 12, 2018

Populate Touch UI dropdown dynamically from sling servlet response.

  • January 12, 2018
  • 1 reply
  • 2342 views

Hi,

I'm trying to populate a select dropdown in the page properties for experience fragments with the JSON response returned by a sling servlet.

In my page properties, I have two dropdowns: brand and author. Brand is populated via datasource using acs-commons generic lists. The author dropdown needs to fetch authors from an external service based on the brand selected and get populated with all the authors for that brand. I have a sling servlet (/services/users/get?brand=<brand>) that fetches the users/authors as a JSON Array. JSON Objects have name and ID properties that need to map to text and value within AEM for each dropdown selection. If the brand value is changed in the dialog, the author field should fetch the users for the current selected brand.

What's the best approach for something like this? Should I be relying purely on dialog listeners or create a datasource using the response from the servlet?

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

1 reply

smacdonald2008
Level 10
January 12, 2018

See this article that shows you how to populate Touch UI Select fields using a DataSource  -- Scott's Digital Community: Using an WCMUsePojo class to populate an Experience Manager Touch UI Select Field