Cascading drop down lists
A cascading drop-down list is a series of dependent DropDownList controls in which one DropDownList control depends on the parent or previous DropDownList controls. The items in the DropDownList control are populated based on an item that is selected by the user from another DropDownList control.
For the purpose of this tutorial, I have used Geonames REST API to demonstrate this capability.
There are a number of organizations providing this kind of service and as long as they have well documented REST API’s you can easily integrate with AEM Forms using the data integration capability
The following steps were followed to implement cascading drop down lists in AEM Forms
Create developer account
Create a developer account with Geonames. Make a note of the username. This username will be needed to invoke REST API’s of the geonames.org.
Create Swagger/OpenAPI file
OpenAPI Specification (formerly Swagger Specification) is an API description format for REST APIs. An OpenAPI file allows you to describe your entire API, including:
Available endpoints (/users?lang=en) and operations on each endpoint (GET /users, POST /users)
Operation parameters Input and output for each operation
API specifications can be written in YAML or JSON. The format is easy to learn and readable to both humans and machines.
To create your first swagger/OpenAPI file, please follow the OpenAPI documentation