Skip to main content
Level 6
January 24, 2022
Solved

creating the dropdown text and value returned from the servlet

I have created one servlet which runs whenever we select the dropdown and then it printwrite the key and value that should the dropdown text and value 

function callToServlet(txt){ $.ajax({ type:'GET', data: { country : txt //let it be India }, url: '/bin/residential/country-dropdown', success: function(txt) { console.log('success'); console.log(txt); //This is printing Key=Up, Value="Lucknow",etc } }) }

 

Not I have to make it a drop down from the txt

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
BrianKasingli
BrianKasingliAccepted solution
Adobe Champion and Community Advisor
January 24, 2022

1 reply

BrianKasingli
Adobe Champion and Community Advisor
BrianKasingliAdobe Champion and Community AdvisorAccepted solution
Adobe Champion and Community Advisor
January 24, 2022

The proper way to do this is using the Granite UI DataSource factory. 

 

You can find examples here:
https://levelup.gitconnected.com/aem-populate-a-drop-down-with-a-data-source-edafada90cc4

 

https://redquark.org/aem/day-17-granite-datasources/

 

minimal code: Or you can try out the ACS Commons Generic Lists for countries selection, example here https://sourcedcode.com/blog/aem/re-usable-color-select-in-touch-ui-dialogs-w-acs-commons-generic-lists

 

Translate