Datasource in Form Options Dropdown | Community
Skip to main content
March 22, 2022
Solved

Datasource in Form Options Dropdown

  • March 22, 2022
  • 1 reply
  • 3444 views

Hi all, 

I am new to AEM forms, I want to create a registration form where I need to get states from the dropdown using Datasource. Can anyone help me how to do this with datasource so that dropdown values pushed automatically on the page ??

 

 

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 JeevanRaj

Got it. You will have to create a granite datasource for this. I'll link below on how to create a granite datasource. Create a slingServlet registered with resourceType. This resourceType should be given in the 'Datasource' field in the forms dialog. In the sling servlet, you can add a DataSource object and push in the states values here.

 

https://redquark.org/aem/day-17-granite-datasources/

 

 

1 reply

JeevanRaj
Community Advisor
Community Advisor
March 22, 2022

Hi @tessa_learner1 

 

If my understanding is correct, you want list of states in a dropdown using datasource. There are lot of solutions for this and i'm gonna link them below.

https://levelup.gitconnected.com/aem-populate-a-drop-down-with-a-data-source-edafada90cc4

 

ACS commons solution using generic list: https://www.youtube.com/watch?v=Mi35V3cdmBo

 

Thanks

March 23, 2022

Hello @jeevanraj  Yes, I want a states dropdown using datasource. Actually I have tried this with custom component it's working. But I just want to do with AEM form options(core form container) since I'm creating Registration form. So I don't know how to create this datasource in form options. Can you guide me ??

JeevanRaj
Community Advisor
JeevanRajCommunity AdvisorAccepted solution
Community Advisor
March 23, 2022

Got it. You will have to create a granite datasource for this. I'll link below on how to create a granite datasource. Create a slingServlet registered with resourceType. This resourceType should be given in the 'Datasource' field in the forms dialog. In the sling servlet, you can add a DataSource object and push in the states values here.

 

https://redquark.org/aem/day-17-granite-datasources/