multifield component

Avatar

Avatar

manpreetk

Avatar

manpreetk

manpreetk

17-04-2019

How can we create a multifield using a sightly with a single text field form the html file.?

Replies

Avatar

Avatar

Ravi_Pampana

MVP

Avatar

Ravi_Pampana

MVP

Ravi_Pampana
MVP

17-04-2019

Hi,

Below is the example of multi field component in AEM 6.4 using sightly

Adobe Experience Manager Help | Creating a HTL Repeating Data Set 6.4 Component that uses Sling Mode...

Avatar

Avatar

manpreetk

Avatar

manpreetk

manpreetk

17-04-2019

Hi , Is there any alternative way, writing some javascript code and fetching the values?

Avatar

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Reply

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Reply

2.3K
smacdonald2008

17-04-2019

Best way is to use SLing Model and inject the MF into the model and read the values in HTL.

Why would you want to hack this by using Javascript when HTL is very easy to render the values entered into the Multifield?

<div

    data-sly-use.multiItems="aem.community.mf.core.models.Multifield">

    <div data-sly-list.head="${multiItems.products.listChildren}">

        <div style="height:250px;"><img src=${head.pathbr} height=200 width=270 style="padding:4px"/><h2>${head.product}</h2>

                             <p>${head.desc}</p>

                             </div>

                             <hr>

   </div>

</div>

Avatar

Avatar

manpreetk

Avatar

manpreetk

manpreetk

17-04-2019

Hi smacdonald2008, I tried using the below sightly code for my multifield component.         

  • ${item.linkText}

    where linkText is my multifiled node name. wont't this be the correct approach?

Avatar

Avatar

manpreetk

Avatar

manpreetk

manpreetk

17-04-2019

<sly                        data-sly-list="${resource.children}">         

  • ${item.linkText}

Avatar

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Reply

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Reply

2.3K
smacdonald2008

17-04-2019

Follow that article referenced above and you will see exactly how it works.

For a MF - you need to inject the MF node into the SLing MODEL (as shown in the article) - if you do not - it will not work. I recommend following it EXACTLY step by step - and you will see how it works,

Avatar

Avatar

Prince_Shivhare

Avatar

Prince_Shivhare

Prince_Shivhare

17-04-2019

please check this multifield article.

Creating a Tab layout component for Adobe Experience Manager

Also use coral ui multifield in replace of that.