Expand my Community achievements bar.

SOLVED

Fetch Data into dropdown field via servlet/WCM POJO and display on a page.

Avatar

Level 3

Hello Community,

I've a question about Dynamically populating a Dialog's checkbox/dropdown and showing all the selected values (Title) on a page.

My Usecase is:

Whenever I open a page something like.. /content/myproject/categories/category1.html, it should show the child nodes created in dam something like.. /content/dam/myproject/categories/category1/subfolder1.1
/content/dam/myproject/categories/category1/subfolder1.2

Similarly, when I open a page /content/mypoject/categories/category2.html, it should show it’s child nodes
/content/dam/myproject/categories/category2/subfolder2.1
/content/dam/myproject/categories/category2/subfolder2.2

I've to show the Title of the Subfolders on the final page (wherever, my component will be drop and drag).

<ul>

<li>Subfolder Title 1.1</li>

<li>Subfolder Title 1.2</li>

</ul>

I’ve used datasource logic, to fetch the subfolder’s list in my component’s dialog and I’m able to get the list but when I’m using the property “name” in my html file to fetch the selected values in the dropdown, it’s showing the name of the node, instead I’m looking for a Title of the node.

Also,
1). How to select multiple subfolders in the dropdown or Checkboxes and show the Title of the Node on the page?
2). How to show the multiple selected subfolders in it’s own tag <li>?

I need this on both Classic and Touch UI.

Any idea, how to get this output on the page?

1 Accepted Solution

Avatar

Correct answer by
Level 1

Just a thought.. may be you can try similar to Tags/keywords.. which you should be able to read and display as seperate <li> tags

sample.png

View solution in original post

3 Replies

Avatar

Level 10

If you want to populate a drop-down field in a component dialog - you need to use a DataSource object -- Scott's Digital Community: Dynamically updating AEM TouchUI Select Fields

If you want to display sub nodes in a web page ( How to show the multiple selected subfolders in it’s own tag <li>) -- you need to write Java logic to read the child nodes of the current page, populate data members and add it to a list in WCMUsePojo. Then have HTL to iterate the list and write out the results. 

TO learn how to handle a list in HTL - see this article -- Scott's Digital Community: Creating an Adobe Experience Manager HTL component that displays a repeat...

In your use case - instead of reading  Multifield values from a component dialog, you need to access the current page and then use Java logic to read the child nodes.

Avatar

Level 3

I've implemented in both the ways

1). By creating a DataSource Object and populating values (sub-nodes) in the dropdown and

2). By using WCMUsePojo and iterate the nodes in htl.

But, the issue I'm getting in both the approaches is

1). If I go by first approach, then all the sub-nodes are coming in a single <li> tag but I want the output on different <li> tags, depends on the author which sub-nodes, he wants to select and show on a page.

2). If I go by WCMUsePojo approach, then I'm getting the sub-nodes values in individual <li> tags, which is the expected output but there might be some scenarios that sub-node is present in the CRXDE but author doesn't want to show it on a Page. So, If I'm using WCMUsePojo approach and iterating in htl then by default all the sub-nodes are showing on a page which is not the expected output.

Avatar

Correct answer by
Level 1

Just a thought.. may be you can try similar to Tags/keywords.. which you should be able to read and display as seperate <li> tags

sample.png