Dynamically populate the value in one dropdown based on other dropdown selection | Community
Skip to main content
Level 2
Feb 26, 2018 2:46 PM UTC
Solved

Dynamically populate the value in one dropdown based on other dropdown selection

Hi Team,

In dialog there are two drop downs, values are coming from backend usingservlet call. Once the author selects the field in dropdown i need to make the call to another servlet based on first drop down selected value and show the options. How to achieve this, i am using classic ui. Please help.

Thanks

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
smacdonald2008
smacdonald2008Accepted solution
Level 10
Feb 26, 2018 3:02 PM UTC

As you are working in Classic UI - to perform this use case, you need to write a custom xtype. In the code of the custom xtype, you can invoke the servlet. 

Details here on how to write a custom xtype that shows how to populate a 2nd field based on the 1st selection (in your use case, populate the 2nd with the values returned from the servlet):

Scott's Digital Community: Dynamically updating AEM custom xtype fields

Hope this helps....

4 replies

smacdonald2008
Level 10
Feb 26, 2018 4:02 PM UTC

Here is an older article that can guide you on how to call a servlet from a custom xtype -- Scott's Digital Community: Invoking Sling Servlets from AEM xtype widgets

Translate
smacdonald2008
Level 10
Feb 26, 2018 4:00 PM UTC

Its still the same answer - you need to code business logic in the xtype JS file (the custom xtype). Other than using custom JAVAScript logic implemented as a custom xtype - there is no other way to implement this use case.

Translate
Level 2
Feb 26, 2018 3:56 PM UTC

Hi smacdonald2008​,

Thanks for the prompt reply!

My query is still not resolved, i can elaborate my question more:  Based on first drop down selected value i need to pass it as a parameter to the second drop down's servlet and again once the user select the second drop down value there is third drop down which makes a call to third servlet with second drop down selected value as a parameter.

Translate
smacdonald2008
smacdonald2008Accepted solution
Level 10
Feb 26, 2018 3:02 PM UTC

As you are working in Classic UI - to perform this use case, you need to write a custom xtype. In the code of the custom xtype, you can invoke the servlet. 

Details here on how to write a custom xtype that shows how to populate a 2nd field based on the 1st selection (in your use case, populate the 2nd with the values returned from the servlet):

Scott's Digital Community: Dynamically updating AEM custom xtype fields

Hope this helps....

Translate