PDF Editing Issues

How to Create a PDF Form That Auto-Populates Fields Using ITA Codes

Chanuka GeekiyanageChanuka Geekiyanage Nov 2, 2026 869 views

Question details

The user needs to create an interactive PDF form that populates corresponding data fields when an ITA or ICAO code is entered, standardizes the display to ICAO, and shows an error message for invalid inputs.

How to Create an Acrobat PDF Form That Auto-Populates Fields Using ITA Codes
Product
PDF Forms
Device & OS
not provided
Scenario
Designing a scalable PDF form for travel or logistics that references a data dictionary to fill out associated field information automatically.
Observed behavior
The intended goal state is a form that accepts an ITA/ICAO input, looks up the code in an embedded dataset, standardizes the input display, populates related fields, or clears the fields and alerts the user if the code is invalid.
Before you start

Ensure you have a professional PDF editor capable of adding custom form fields and document-level JavaScript, and have your dataset of ITA/ICAO codes prepared.

Solution 1Recommended

Use Document-Level JavaScript and Custom Field Validation

Embed your ITA/ICAO dataset as a document-level JavaScript object and use custom validation scripts on the input field to trigger the auto-population logic.

To achieve this functionality without requiring a live external database connection, you must embed the lookup data directly into the PDF. By placing the dataset in a Document-Level script, the data loads when the PDF opens and remains accessible to any form field, allowing you to easily update the array when the data expands later.

1
Prepare the Form Fields

Create a text field for the user to enter the code (e.g., 'CodeInput') and create the target text fields that will receive the populated data (e.g., 'AirportName', 'City', 'Country').

2
Add a Document-Level JavaScript

Navigate to the JavaScript settings in your PDF editor and add a Document-Level script. Define a JSON object or array containing your ITA/ICAO codes as keys, and their related data as values.

3
Apply Custom Validation Script

Right-click the 'CodeInput' field, go to Properties, and select the Validate tab. Choose 'Run custom validation script' and enter your lookup logic.

4
Write the Lookup and Validation Logic

In the validation script, write a function that takes the user's input and checks it against your document-level dataset. If a match is found, assign the corresponding data to the target fields and change the event.value to standard ICAO format. If no match is found, set the target fields to blank and use the app.alert() function to display a helpful error message.

Use Document-Level JavaScript and Custom Field Validation
Scalability Consideration: Structuring your dataset cleanly within a single document-level script ensures that when you need to expand the data later, you only have to update that one script rather than modifying multiple form fields individually.
Advanced PDF Form Creation

Create Interactive PDF Forms Easily with WPS Office

WPS Office offers a robust PDF editor that empowers you to design interactive forms with ease. Whether you need text fields, checkboxes, or dropdowns, WPS PDF provides seamless tools to build and fill forms efficiently.

  1. 1. Open PDF Editor: Launch WPS Office and open your target PDF document, or create a new blank PDF.
  2. 2. Access Form Tools: Navigate to the 'Form' tab on the top ribbon to access the interactive form controls.
  3. 3. Insert Form Fields: Select the 'Text Field' tool to place input boxes for your codes and data outputs directly onto the page.
  4. 4. Save and Distribute: Save your document. The resulting interactive PDF can be filled out reliably by users across different platforms.
Comprehensive form building tools including text fields and dropdownsHighly compatible with standard Adobe Acrobat PDF form formatsLightweight and cost-effective alternative to heavy PDF editorsIntuitive UI that makes creating and managing PDFs simple for all users
microsoft office alternative - wps office

Frequently Asked Questions

What is document-level JavaScript in a PDF?

Document-level JavaScript is code embedded directly into the PDF file that executes when the document is opened. It is typically used to store global variables, arrays, or functions that multiple form fields need to access, such as a centralized dataset for ITA codes.

How do I display an error message for invalid entries in a PDF?

You can use the 'app.alert("Message");' function within a field's custom validation script. If the user's input does not match any code in your predefined dataset, the script triggers this alert to notify them.

Can my PDF form automatically pull data from a live database?

Standard PDF forms cannot easily query live external SQL databases due to strict security restrictions in most PDF viewers. To auto-populate data, the best practice is to embed the necessary lookup table directly within the PDF using document-level JavaScript.