Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

ListBox or Dropdown menu selection(s) autofill a text field

Explorer ,
Nov 30, 2025 Nov 30, 2025

I am attempting to create a document where the person can select 1 or more options in the ListBox feature  (or drop down menu if easier?) and this would autofill different text fields based on the selection – each selection would have a corresponding phrase that would autofill a in a text field. Then, each text field can only be used once, so once the first text field has a phrase in it, the next phrase (corresponding to listbox selection) would auto-insert into the next text field, etc.

I had a similar question to this regarding check boxes, so will use the same examples here but instead of each check box specific to each item, it would be a list box (or drop down menu) that would have all possible selections (ex: blood work, xrays, follow up appointment, etc.) in the one listbox/drop down menu and each selection inside of the box would autofill a specific phrase. If this is too complex or complicated, please let me know I’m more than happy to stick with check boxes. Also, here is a link to me other question just for reference.

https://community.adobe.com/t5/acrobat-discussions/autopopulating-text-fields-on-different-page/m-p/...

TOPICS
How to , JavaScript , PDF forms
85
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 30, 2025 Nov 30, 2025

The basic code to use is this (as the custom calculation script of the text field):

 

var sel = this.getField("Dropdown1").valueAsString;

if (sel=="ABC") event.value = "Some text for ABC";

else if (sel=="DEF") event.value = "Some other text for DEF"; // etc.

else event.value = "";

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 30, 2025 Nov 30, 2025

Thank you - would this work if all options are selected from 1 dropdown menu? or would this require multiple dropdown lists?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 30, 2025 Nov 30, 2025
LATEST

This code is based on selection in a single drop-down field, which is what I understood you asked for. If you want it to be dependent on the values of multiple fields, it would require a more complex code.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines