Create the structure for the countries component
[AEM Forms as a Cloud Service]{class="badge informative"}
Log in to your AEM Forms instance and follow these steps to create a new component based on the out-of-the-box dropdown component:
- Navigate to ‘/apps/<yourproject>/components/adaptiveForm/dropdown’ in CRXDE Lite.
- Copy the dropdown component and paste it at the same directory level.
- Rename the copied component to countries.
- Update the jcr:title property of the cq:template node to Countries.
- Save the changes.
You now have a new component named Countries, which is an exact replica of the out-of-the-box dropdown component. This serves as the foundation for further customization.
Create the HTL file
To create the HTL file for the Countries component:
- Navigate to the countries folder in the crx repository
- Create a new file named countries.html.
- Open the /apps/core/fd/components/form/dropdown/v1/dropdown/dropdown.html file in the crx repository and copy its contents.
- Paste the copied content into countries.html.
- Change the code to use the new sling model as shown in the screen shot
- Save your changes.
Finally, sync your project with these updates to ensure the changes in the CRX repository are reflected in your AEM project.
4859a77c-7971-4ac9-8f5c-4260823c6f69