PDF Editing Issues

How to Display Text Labels Instead of Numeric Codes in PDF Forms

Natalie TaylorNatalie Taylor Nov 5, 2026 869 views

Question details

The user needs a PDF form template to automatically convert and display descriptive text labels when raw numeric item codes are inputted or received.

How to Display Text Labels Instead of Numeric Codes in PDF Forms
Product
PDF
Device & OS
not provided
Scenario
A PDF form template is designed to receive numeric item codes (like 000 or 001) from users or other applications, but needs to output a human-readable text label.
Observed behavior
The form field currently displays the raw numeric code natively rather than interpreting it and rendering the desired corresponding text label.
Before you start

Ensure you are using a PDF editing application that supports JavaScript form field validation and verify exactly which item codes need to be mapped to which labels.

Solution 1Recommended

Add a JavaScript Validation Script to the Form Field

This is the most direct method to alter the displayed value upon input, using a simple validation script to prefix or replace the numeric code.

By applying a custom JavaScript validation rule directly to the item field, you can intercept the numerical input and instantly modify the text that appears on the screen before the user moves to the next field.

1
Access Field Properties

Open your PDF form in edit mode, right-click the specific item field you want to modify, and select 'Properties' from the context menu.

2
Navigate to the Validate Tab

In the Properties dialog box, click on the 'Validate' tab to view the data validation options for that specific field.

3
Enter the Validation Script

Select 'Run custom validation script' and click the 'Edit' button. Enter the script: event.value = "Label" + event.value; (replacing "Label" with your desired text), then click 'OK' to save.

4
Test the Form Field

Exit form editing mode and type a numeric code like '000' into the field. Press Enter or click away to confirm the text changes to 'Label000'.

Add a JavaScript Validation Script to the Form Field
Script Application: Once applied, any numeric code entered into this field will automatically be prefixed or replaced according to your JavaScript rule.
Advanced PDF Tools

Edit and Manage PDF Forms Easily with WPS Office

WPS Office provides a comprehensive PDF editor that allows you to create, edit, and manage interactive PDF forms effortlessly. Adjusting form properties, filling out templates, and managing standard PDF data is intuitive and seamless.

  1. 1. Open PDF in WPS: Launch WPS Office and open your target PDF form document.
  2. 2. Access Form Tools: Navigate to the 'Form' tab in the top ribbon to access editing options.
  3. 3. Edit Field Properties: Double-click any form field to open its properties and adjust formatting, values, or validation rules as needed.
Easily edit PDF form fields, text properties, and document layoutsHigh compatibility with standard PDF formats and Adobe Acrobat formsLightweight and intuitive interface for quick document processing across devices
microsoft office alternative - wps office

Frequently Asked Questions

Why is my PDF form validation script not running?

JavaScript may be disabled in your PDF reader's security settings. Go to the application preferences, look for 'JavaScript' settings, and ensure that 'Enable Acrobat JavaScript' or the equivalent option is turned on.

Can I use entirely different labels for specific numeric codes instead of just a prefix?

Yes. Instead of a simple concatenation script, you can write an 'if/else' or 'switch' statement in your JavaScript validation to map specific codes to entirely different text labels (e.g., if code is '001', event.value = 'Apples').

Will these scripts work if I print the PDF?

Yes. Once the script runs and updates the field's displayed value, the resulting text label will be visible on the digital form and will appear exactly as displayed when the document is sent to a printer.