Options from a URL or another sheet for Edge Delivery Services for AEM Forms as a Cloud Service
Forms often include dropdown menus for users to select from predefined options. These options are typically defined within the form itself, but managing long lists can be cumbersome. This guide outlines how to improve form authoring by loading dropdown options from a separate spreadsheet via a URL.
Benefits of loading a dropdown options from a separate spreadsheet are:
- Simplified Management: Maintain dropdown options in a centralized location for easier updates and additions.
- Improved Efficiency: Eliminate the need to manually add long option lists within the form definition.
By the end of this article, you learn to:
Define options in a separate sheet define-options
Defining Options in a Separate Spreadsheet
-
Create a Spreadsheet:
- Locate your AEM project folder in Microsoft® SharePoint or Google Drive.
- Add a new sheet. For example, “shared-country”.
-
Define Option Columns:
Add two columns: “Option” and “Value”.- “Option” defines the text displayed in the dropdown menu.
- “Value” defines the submitted value when a user selects the option.
note note NOTE If both option and value are identical, only the “Option” column is required. -
Populate the Spreadsheet:
Enter your country options in the “Option” column (and “Value” column if necessary).Refer to the example below for structure.
-
Preview and publish the
shared-countrysheet using AEM Sidekick.For example, if your project’s repository is named “wefinance”, it’s located under the account owner “wkndform”, and you’re using the “main” branch, the URL which showcases the
shared-countrysheet:https://main--wefinance--wkndform.aem.live/enquiry.json?sheet=country
?sheet=country is a query parameter appended to the URL. This parameter indicates the JSON filtered based on the shared-country sheet. It redirects to the JSON file containing information related to different countries.Add URL to load drop-down list options add-url
The Options property of a select field accepts a URL. The URL returns a JSON array used as options for the Destination drop-down list. To add the URL to load drop-down list options:
-
Go to your AEM Project folder on Microsoft® SharePoint or Google Drive and open your spreadsheet. You can also create new spreadsheet for a form.
-
Copy the URL of
shared-countrysheet and paste it in theOptionscolumn for theDestinationfield.
-
Preview and publish the sheet using AEM Sidekick.
You can refer to the enquiry spreadsheet to add the URL to load drop-down list options.
After integrating the URL into the form definition to load drop-down list options, the options for the Destination drop-down start appearing from the URL.
For example, if your project’s repository is named “wefinance”, it’s located under the account owner “wkndform”, and you’re using the “main” branch, the below URL displays the enquiry form displaying the options saved in the separate sheet:
https://main--wefinance--wkndform.aem.live/enquiry-form