Aem dialog drop-down option from api in 6.5 | Community
Skip to main content
Level 2
February 16, 2024
Solved

Aem dialog drop-down option from api in 6.5

  • February 16, 2024
  • 4 replies
  • 1581 views

Hi Team, 

We want to create a dilog field where we can load drop-down option of api response when dilog is opened can we try this from datasourse or data source call backend each time when opened?

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

4 replies

AsifChowdhury
Community Advisor
Community Advisor
February 16, 2024

Hi @ashishm85330433 

 

You can create a clientlib with some custom js like this:

 

(function (document, $) { "use strict"; $(document).on("foundation-contentloaded", function (e) { // do your custom code here }); })(document, Granite.$);

 

Then call the clientlib in the component dialog xml using "extraClientlibs" property. This JS will called when you open the dialog.

 

NB. There are some other event available also like you want to do some thing on submit of a dialog.

 

Thanks.

Imran Khan
Community Advisor
Community Advisor
February 16, 2024

@ashishm85330433 DataSource is the best suggested approach to load dropdown options as we can make secure API call to third party system. Its easy to maintain the tokens and other API configuration in backend approach.

We can go ahead with @asifchowdhury approach, if the 3rd party is public and doesn't require any token to access the same. In this we may not require whitelisting to access API.

Level 2
February 16, 2024

Thanks @imran__khan but how datasourse will call servlet.

Imran Khan
Community Advisor
Imran KhanCommunity AdvisorAccepted solution
Community Advisor
February 21, 2024
arunpatidar
Community Advisor
Community Advisor
February 16, 2024
kautuk_sahni
Community Manager
Community Manager
February 21, 2024

@ashishm85330433 Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.

Kautuk Sahni