Read dialog values from datasource | Community
Skip to main content
Level 4
December 31, 2021
Solved

Read dialog values from datasource

  • December 31, 2021
  • 2 replies
  • 1433 views

hi all,

 

in the dialog I have tag picker and dropdown with datasource.

 

I need to populate dropdown with list of child tags for the parent tag selected in tag picker.

What I haven't managed to figure out is how to read dialog props. from datasource handler class.

I tried with sling model and with WCMUsePojo.

 

Thanks

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 arunpatidar

Hi,

The change event should work with tag picker as well. Please let me know if eventing does not work.

2 replies

arunpatidar
Community Advisor
Community Advisor
December 31, 2021

Hi,

You need to convert datasource from sling model to servlet and populate dropdown based on parent value via making a ajax call to datasource servlet with parent tag.

e.g. https://github.com/arunpatidar02/aem63app-repo/blob/master/js/dynamic-dropdown.js

 

Arun Patidar
arunpatidar
Community Advisor
Community Advisor
January 1, 2022
nbg62Author
Level 4
January 2, 2022

Thank you Arun.

 

This looks like my use case, I'll check it out and let you know if I have additional questions.

Bottom line is I should use approach from your second link to get value from first component and use servlet to get list of tags to populate dropdown.

 

Is there other handler for oob tag picker (cq/gui/components/coral/common/form/tagfield), I believe applying class to tag picker will not be applied and also I think change event will not be triggered by tag picker changes ?

 

    $document.on("change", contentTypeSelector, function (e) {
        setSubTypeDropdown(false);
    });

 

Thank you

Happy new year.

arunpatidar
Community Advisor
arunpatidarCommunity AdvisorAccepted solution
Community Advisor
January 3, 2022

Hi,

The change event should work with tag picker as well. Please let me know if eventing does not work.

Arun Patidar