Expand my Community achievements bar.

SOLVED

Creating Dropdown in multifield using Sightly

Avatar

Employee

Hi, I'm trying create a drop using multifield values. Does anyone know the sightly code for this? 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@Keerthana_H_N 

I guess you want to show the multifield items in a dropdown(select).

I have a nested multifield with name options. Multifield has textfield name ./option

Below is HTL to render multifield items as select.

<sly data-sly-list.children="${resource.getChildren}">
    <sly data-sly-test="${children.name == 'options'}">
        <select data-sly-list="${children.getChildren}">
            <option>${item.option}</option>
        </select>
    </sly>
</sly>

View solution in original post

3 Replies

Avatar

Community Advisor

Hi @Keerthana_H_N 

 

If I understand the requirement correctly, you have the multifield in your component dialog and have authored the values in it. Now you want to read those values and populate in HTML as a dropdown by iterating over HTL?

 

Thanks!

Avatar

Correct answer by
Community Advisor

@Keerthana_H_N 

I guess you want to show the multifield items in a dropdown(select).

I have a nested multifield with name options. Multifield has textfield name ./option

Below is HTL to render multifield items as select.

<sly data-sly-list.children="${resource.getChildren}">
    <sly data-sly-test="${children.name == 'options'}">
        <select data-sly-list="${children.getChildren}">
            <option>${item.option}</option>
        </select>
    </sly>
</sly>