Populate a Multiline PDF Text Field from Dropdowns in Adobe Acrobat
Question details
Populate a multiline PDF text field with messages corresponding to dropdowns set to No, while excluding other selections.

- Product
- Adobe Acrobat PDF forms
- Device & OS
- not provided
- Scenario
- A PDF form has several dropdowns with Blank, Yes, N/A, and No options and one field for the resulting messages.
- Observed behavior
- The desired result is a separate line of text for each dropdown set to No, with no text for the other selections.
Open the form in Adobe Acrobat Pro and identify the exact field names and the value stored by each No option. Decide which message should appear for each dropdown.
Add a calculation script to the multiline field in Adobe Acrobat
Use a custom calculation script to rebuild the text field whenever form calculations run.
The example checks three dropdowns and joins their matching messages with line breaks. Replace the sample field names and messages with those in your form.
In Acrobat Pro, open the PDF and select All tools > Prepare a form. Double-click the destination text field to open its properties.
On the Options tab of the text field properties, select Multi-line.
On the Calculate tab, select Custom calculation script and click Edit. Enter this script, then replace Dropdown1, Dropdown2, and Dropdown3 and their messages with your own: var items = [ { field: "Dropdown1", message: "First item needs attention" }, { field: "Dropdown2", message: "Second item needs attention" }, { field: "Dropdown3", message: "Third item needs attention" } ]; var lines = []; for (var i = 0; i < items.length; i++) { var dropdown = this.getField(items[i].field); if (dropdown && dropdown.valueAsString === "No") { lines.push(items[i].message); } } event.value = lines.join("\n");
Close the properties, save the PDF, and test each dropdown by selecting No and then another option. Confirm that matching messages appear on separate lines and disappear when No is no longer selected.

Work with PDFs and Office documents in WPS Office
WPS Office is a free, lightweight alternative with a familiar interface for working with PDFs and Microsoft Office files, making it easy to move between common document formats. Use Acrobat to create and test the custom PDF calculation script; WPS is not a fix for Acrobat JavaScript compatibility.

Frequently Asked Questions
Why does a dropdown set to No not add its message?
In Prepare a form, check the dropdown's exact field name and the No option's export value. Update the script to use that field name and compare against the stored export value.
How do I add more dropdowns to the calculation?
Open the destination field's Properties > Calculate > Custom calculation script > Edit. Add another field and message entry to the items array, using the dropdown's exact name.
Will the script work in a mobile PDF app?
Not necessarily. PDF JavaScript support varies by app and is often limited on mobile devices. Test the saved form in the specific mobile app your users will use.
How can I make the messages appear on separate lines?
In the destination field's Properties > Options, select Multi-line. The calculation script uses lines.join("\n") to separate the messages.




