AEM Component Placeholders the WCM Core Component Way | Community
Skip to main content
JakeCham
Level 6
October 30, 2022
Solved

AEM Component Placeholders the WCM Core Component Way

  • October 30, 2022
  • 1 reply
  • 3042 views

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 

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 Saravanan_Dharmaraj

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.

1 reply

Saravanan_Dharmaraj
Community Advisor
Saravanan_DharmarajCommunity AdvisorAccepted solution
Community Advisor
October 30, 2022

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.