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

AEM Component Placeholders the WCM Core Component Way

Avatar

Level 5

Hi team,

 

Here my code is like below,

line number 1

<!-- Here I cant get a value to isEmpty variable without starting a loop it in this line cas all the fields are inside a multifield. Also if I start a loop from this line it is not the output I want. Simply I don't want to loop it from here-->

<sly data-sly-test.isEmpty="${!proprty_value}"> // property_value should be a mandatory property one 

<sly data-sly-use.templates="core/wcm/components/commons/v1/templates.html"/>

<sly data-sly-call="${templates.placeholder @ isEmpty = isEmpty}"></sly>

 

<sly data-sly-test="${!isEmpty}">

//rendering html has been put here. So when mandatory property has a value only rendering html will be execute otherwise placeholder will be appeared.  

line number 25

</sly>

 

Problem is I have a component where all the properties are inside a multifield and I can't assign a value to isEmpty field without starting a loop from the top of the html. If I starts a loop from top that's not the output I want. I want to loop the code from the 25th of line only. But then I can't get a value to isEmpty field from multifield properties .

 

Any suggestions highly appreciated 

1 Accepted Solution

Avatar

Correct answer by
Level 8

Do you still want to read the multifield list and check to see if the list is empty and show the placeholder text?

 

<div data-sly-test="${!property_value}">List is empty, show the placeholder text</div>

 assuming property_value is multifield value.

View solution in original post

1 Reply

Avatar

Correct answer by
Level 8

Do you still want to read the multifield list and check to see if the list is empty and show the placeholder text?

 

<div data-sly-test="${!property_value}">List is empty, show the placeholder text</div>

 assuming property_value is multifield value.