Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.
SOLVED

Datasource in Form Options Dropdown

Avatar

Level 5

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

 

VanithaB1_0-1647935052565.png

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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/

 

 

View solution in original post

4 Replies

Avatar

Community Advisor

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

Avatar

Level 5

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

Avatar

Correct answer by
Community Advisor

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/

 

 

Avatar

Level 1

Hi @Tessa_learner1 ,

 I am also looking for the similar solution if you found anything earlier , how it can be achieved can you please give me the reference url or can you just add a comment here , it would be helpfull.

thanks in advance.