PDF Editing Issues

How to Create PDF Text Fields with Placeholders and Custom Formats

Olivia MillerOlivia Miller Nov 24, 2026 868 views

Question details

The user wants to configure an interactive PDF text field to display disappearing placeholder text and validate custom symbols like a percentage sign (%).

Creating PDF Text Fields with Placeholder Text and Custom Formats
Product
PDF Editor
Device & OS
not provided
Scenario
Designing an interactive PDF form that requires instructional placeholder text and specific data formats (like percentages) without using clunky keystroke scripts.
Observed behavior
Existing keystroke scripts for managing the % symbol are prone to user error, such as users accidentally deleting the symbol or typing on the wrong side of it.
Before you start

Ensure you have access to the form editing mode and JavaScript console in your PDF editor before applying custom formatting scripts.

Solution 1Recommended

Use Format Scripts and a Static Label for the Percentage Symbol

Instead of using complex keystroke logic, configure a format script for the placeholder text and place a separate static text field to display the custom percentage symbol.

Using keystroke scripts to force a custom symbol (like '%') inside an active input field is prone to user deletion and cursor positioning errors. A more robust approach is to separate the label from the input field to prevent users from accidentally altering it.

1
Add a Static Text Field for the Symbol

Insert a new text field immediately to the right of your data entry field. Set its default value to '%', make it read-only, and remove any borders so it visually merges with the input field.

2
Apply a Format Script for Placeholder Text

Open the properties of your data entry field. Go to the 'Format' tab, select 'Custom', and enter a formatting script that checks if the field is empty (e.g., if(event.value == ""){event.value = "Instructions"; event.target.textColor = ["G",.5];}). Change the text color to gray when displaying the instruction and black otherwise.

3
Set Data Entry Validation Limits

Navigate to the 'Validate' tab in the text field properties. Set the acceptable data range (for example, between 1 and 100) to ensure users enter valid percentage amounts without typing the symbol themselves.

Use Format Scripts and a Static Label for the Percentage Symbol
Best Practice: Using a separate field for the percentage sign prevents users from accidentally deleting the symbol during data entry and simplifies the validation process.
Easy PDF Form Creator

Create and Fill Interactive PDF Forms with WPS Office

WPS Office provides comprehensive PDF editing tools that allow you to design, fill, and manage interactive PDF forms effortlessly. Easily insert text fields, check boxes, and static labels without needing complex JavaScript knowledge.

  1. 1. Open WPS PDF: Launch WPS Office and open the PDF document you want to convert into a form.
  2. 2. Access Form Tools: Navigate to the 'Form' tab located on the top ribbon of the PDF interface.
  3. 3. Add Fields and Labels: Click 'Text Field' to insert user entry boxes. You can also use the standard 'Add Text' tool to place static percentage labels next to your input fields for clean and foolproof form design.
Seamlessly insert and customize PDF form fieldsFully compatible with standard PDF document formatsRead, edit, and convert PDFs effortlesslyLightweight application with an intuitive user interface
microsoft office alternative - wps office

Frequently Asked Questions

Why does my placeholder text not disappear when users click the PDF text box?

This usually happens because the OnFocus script is missing or the Format script doesn't correctly identify the default state. Ensure your Javascript sets the field value to empty and changes the text color when the user clicks inside the field.

Can I just include the '%' sign dynamically in my keystroke script?

While it is possible to use a keystroke script to append special characters dynamically, it is generally discouraged because it creates a clunky user experience. Users can easily delete the symbol or type numbers on the wrong side of it, breaking the form's logic.

Where do I add custom Javascript in PDF text fields?

Right-click the text field, select 'Properties', and then navigate to the 'Format' tab to add custom format scripts, the 'Validate' tab for validation scripts, or the 'Actions' tab to trigger OnBlur and OnFocus events.