Test if MultiField has items | Community
Skip to main content
jndoy
New Participant
Mar 8, 2017 9:17 PM UTC

Test if MultiField has items

How can you use data-sly-test to check if a MultiField Helper has items?

<div data-sly-use.helper="${'com.cibcpublic.aem.core.util.MultiFieldHelper' @ propertyName='socialmedia'}" data-sly-unwrap>

I tried <div data-sly-test="${socialmedia.listChildren}"> but that didn't work.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

smacdonald2008
Level 10
Mar 9, 2017 2:42 PM UTC

Never tried testing on front end - most of the time when using Multi-field - we are reading the Multi-field data (that an author enters) using Java on the backend - see: 

https://helpx.adobe.com/experience-manager/using/htl_multifield62.html

https://helpx.adobe.com/experience-manager/using/htl_repeat.html

As you can see in these articles - you can get at the node level and then write app logic to read the node to see if there are values. 

Translate
jndoy
jndoyAuthor
New Participant
Mar 16, 2017 3:54 PM UTC

I'm talking about in Sightly just detecting if items and their fields have been entered in the dialog by the author.

Translate