Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Creating Dropdown in multifield using Sightly

Keerthana_H_N
Level 2
Level 2

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

1 Accepted Solution
Anudeep_Garnepudi
Correct answer by
Community Advisor
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

0 Replies
Asutosh_Jena_
Community Advisor
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!

Anudeep_Garnepudi
Correct answer by
Community Advisor
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