Skip to main content
Known Participant
November 30, 2025
Question

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

  • November 30, 2025
  • 1 reply
  • 179 views

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/15601550#M525325

1 reply

try67
Community Expert
Community Expert
November 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 = "";

Known Participant
November 30, 2025

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

try67
Community Expert
Community Expert
November 30, 2025

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.