Creating Dropdown in multifield using Sightly | Community
Skip to main content
Employee
April 21, 2021
Solved

Creating Dropdown in multifield using Sightly

  • April 21, 2021
  • 2 replies
  • 1182 views

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

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

@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>

2 replies

Anudeep_Garnepudi
Anudeep_GarnepudiAccepted solution
New Participant
April 27, 2021

@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>
Employee
April 29, 2021
Thank you, was very helpful
Asutosh_Jena_
New Participant
April 21, 2021

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!