Displaying a horizontal List
New to Adobe Forms! Would like multiple selections from a drop down list to be displayed horizontally when selected ie dog, cat, bird. Appreciate the help
New to Adobe Forms! Would like multiple selections from a drop down list to be displayed horizontally when selected ie dog, cat, bird. Appreciate the help
Hello @Barbara31866811kotk,
I hope you are doing well, and thanks for reaching out and sharing the details. Sorry for any trouble you had.
Could you please share more details about the request/workflow?
Which Adobe product is the user referring to? Adobe Acrobat form fields (PDF forms).
Are you creating this in Adobe Acrobat PDF forms or AEM Adaptive Forms?
Is the field currently a drop-down list with multiple selection enabled or a list box with multiple selection enabled?
Are you on a Mac or Windows machine, and what is the version?
Suggestions for Adobe Acrobat PDF forms.
Use a List box, not a Drop-down field, for multiple selections.
In Acrobat’s form-field properties, Multiple selection is listed under List box properties. The same Adobe Help page does not list a built-in “show selected values horizontally/comma-separated” display option for a drop-down or list box. See this article for more information: https://adobe.ly/4fSNXAt
In Acrobat, go to All tools > Prepare a form.
Add or select your List box field, then right-click it and choose Properties
Go to the Options tab:
Add your choices, for example: dog, cat, bird
Enable Multiple selection
Optional: enable Commit selected value immediately if you want the field value to update as soon as the user changes the selection.
If you want the selected items to appear as a horizontal result, like dog, cat, bird, Acrobat does not document a native field-property setting that does this automatically in the same list/drop-down field. The supported Acrobat approach is to use a separate text field and populate it with an Acrobat JavaScript calculation. Acrobat Help documents Custom calculation script under the field Calculate tab, and Adobe’s Acrobat JavaScript guide documents list box multiple selections using currentValueIndices and getItemAt. See these articles for more information: https://adobe.ly/4fZDHGT
Example custom calculation script for the text field: Please note that you need to customise the script as per your needs, as this is only a sample code and may or may not work depending on the environment, app and os version, or any restrictions applied to the app, os, or user environment.
var listField = this.getField("PetList"); // Change PetList to your list box field name
var selected = listField.currentValueIndices;
if (selected == null || selected == -1) {
event.value = "";
} else if (typeof selected == "number") {
event.value = listField.getItemAt(selected, false);
} else {
var values = [];
for (var i = 0; i < selected.length; i++) {
values.push(listField.getItemAt(selected[i], false));
}
event.value = values.join(", ");
}
I hope this helps, and let us know how it goes. Please reach out if you need any further assistance.
Regards,
Anand Sri.
Already have an account? Login
No account yet? Create an account
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.