top of page
  • Writer's pictureHeena

How to iterate Multifield simply using HTL

Updated: Jul 23, 2023

Let's refer Multifield we created here, which has following fields:

Multifield Example Dialog

Following HTML uses Sling Model to access multifield values:

<section 
data-sly-use.props="com.aemblog.core.models.MultifieldExampleSlingModel">
    <div data-sly-list.multifielditem="${props.multifieldList}">
           <p>Title: ${multifielditem.name}</p>
           <p>URL: ${multifielditem.url}</p>
    </div>
</section>

Following HTML uses Global Object resource to access multifield values:

<section 
data-sly-list.props="${resource.getChildren}">
    <div data-sly-test="${props.name == 'multifieldList'}"
    data-sly-list.multifielditem="${props.getChildren}">
           <p>Title: ${multifielditem.name}</p>
           <p>URL: ${multifielditem.url}</p>
    </div>
</section>

Using HTL for accessing Multifield values comes handy when no custom processing is required on dialog values.


437 views

Related Posts

See All
bottom of page