PDF Editing Issues

Populate a Rich-Text Field from an Acrobat Drop-Down

Amos GikundaAmos Gikunda Nov 19, 2026 868 views

Question details

Populate a PDF text field with differently formatted descriptions based on a drop-down selection.

Populate a Rich-Text Field from an Acrobat Drop-Down
Product
Adobe Acrobat PDF forms
Device & OS
not provided
Scenario
A PDF form should show a description with line breaks, colors, and font sizes that correspond to the selected drop-down option.
Observed behavior
The desired result is a rich-text description that changes when the user selects a different option.
Before you start

Open the form in Adobe Acrobat with access to the Prepare a Form tool. Check the drop-down field name and its option export values, and decide which descriptions and formatting each value should produce.

Solution 1Recommended

Use an Acrobat calculation script to set rich-text spans

Use a custom calculation script on the destination text field when each drop-down option needs its own formatted description.

A drop-down export value identifies the selected option, but it does not carry the rich formatting for the destination field. The script can instead assign an array of formatted text spans to event.richValue.

1
Configure the drop-down

In Acrobat, open Prepare a Form and double-click the drop-down. On the General tab, note its field name. On the Options tab, check the item and export values and enable Commit selected value immediately.

2
Enable rich text

Double-click the destination text field in Prepare a Form. On its Options tab, enable Multi-line and Allow Rich Text Formatting so it can display formatted text and line breaks.

3
Add the calculation script

In the destination field's Properties dialog, open Calculate, select Custom calculation script, and click Edit. Enter the following example, replacing DescriptionChoice, Option A, and Option B with your field name and actual selection values: var choice = this.getField("DescriptionChoice").value; event.target.richText = true; if (choice === "Option A") { event.richValue = [ {text: "Option A\n", textSize: 16, textColor: color.red}, {text: "First description.", textSize: 11, textColor: color.black} ]; } else if (choice === "Option B") { event.richValue = [ {text: "Option B\n", textSize: 14, textColor: color.blue}, {text: "Second description.", textSize: 11, textColor: color.black} ]; } else { event.richValue = [{text: ""}]; }

4
Test each selection

Close the field properties, click Preview in Prepare a Form, and select each drop-down option. Confirm that the destination field updates and displays the intended line breaks, colors, and sizes.

Use an Acrobat calculation script to set rich-text spans
Check selection values and viewer support: If an option has an export value, compare the script against that value rather than its displayed label. Test the saved form in the intended PDF viewer; JavaScript and rich-text form support can vary.
Free Microsoft Office alternative

Work with PDFs and Office files in WPS Office

WPS Office is a free, lightweight alternative with a familiar interface for working with PDFs and Office documents. Its format compatibility makes it easy to bring existing files into your workflow, although it does not replace the Acrobat scripting solution described above.

Open and review PDF documents alongside your other filesCompatible with Microsoft Word, Excel, and PowerPoint formatsUse a familiar interface for a smoother move from Microsoft OfficeAccess a lightweight office suite with free features
microsoft office alternative - wps office

Frequently Asked Questions

Can a drop-down export value include rich formatting?

The export value identifies the selected option; it does not supply the destination field's rich formatting. Use a calculation script to map that value to formatted spans.

Where do I add the Acrobat script?

In Prepare a Form, open the destination text field's Properties, select the Calculate tab, and choose Custom calculation script. Click Edit to enter the script.

Why doesn't the description update when I select an option?

Check that Commit selected value immediately is enabled on the drop-down's Options tab. Also verify the field name and export values in the script, and make sure form calculations and JavaScript are enabled in the viewer.

How do I add a line break or change the text color?

In the script's span array, include \n in a span's text for a line break. Set textColor, such as color.red, and textSize on each span to control its appearance.

Will the form work in every PDF viewer?

Not necessarily. PDF viewers differ in their support for Acrobat JavaScript and rich-text fields, so test the saved form in the viewer your recipients will use.