Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

How to fetch the values from multifield child nodes by using HTL?

Avatar

Level 1

i have multifield component and the property (composite=true) so its storing the values one by one like nodes, without using sling model is there any way to get values from those nodes like using htl(sightly).

i tried myself when this component have property (composite=false) so its storing the values in string array format and i used this one...its working but dont know for (composite=true)...


label: ${resource.label}<br>
number:${resource.number}

<div data-sly-resource="${'/content/training/homepage/jcr:content/parsys/multifieldcomponentt' }

 

</div>

 

 

1 Accepted Solution

Avatar

Correct answer by
Level 3

Hi @mrmachi ,

 

if you are creating any component with multifield (composite = true) It would be easier to create either a Sling Model or Java / Javascript Use API class to get the list and then use it in the HTL file.

 

But, if you want to access them through HTL you can refer this article where it will differentiate the usage of multifield using sling models/ only through pure HTL.

https://levelup.gitconnected.com/aem-how-to-use-nested-multifields-in-your-components-using-a-sling-...

 

 

View solution in original post

2 Replies

Avatar

Correct answer by
Level 3

Hi @mrmachi ,

 

if you are creating any component with multifield (composite = true) It would be easier to create either a Sling Model or Java / Javascript Use API class to get the list and then use it in the HTL file.

 

But, if you want to access them through HTL you can refer this article where it will differentiate the usage of multifield using sling models/ only through pure HTL.

https://levelup.gitconnected.com/aem-how-to-use-nested-multifields-in-your-components-using-a-sling-...

 

 

Avatar

Level 7

@mrmachi Its recommonded to use sling model to get the list and then use it in the HTL file accordingly.

You can use

@ChildResource
private <ClassName> <objName>