How to Add Instructional Ghost Text to Acrobat PDF Form Fields
Question details
The user needs to insert instructional placeholder text (ghost text) like "Event Time" inside a PDF form field, which disappears when a value is entered.

- Product
- Adobe Acrobat Pro DC
- Device & OS
- not provided
- Scenario
- Designing a user-friendly, interactive PDF form where text fields provide built-in instructions without permanently interfering with the user's actual input.
- Observed behavior
- The standard form fields lack built-in placeholder attributes that automatically clear instructional text when clicked or typed into, requiring a programmatic workaround.
Ensure you have your PDF opened in a professional PDF editor with form preparation and JavaScript capabilities, such as Adobe Acrobat Pro DC.
Use a Custom JavaScript Format Script
You can add a simple JavaScript snippet to the form field's formatting properties to automatically display instructional text when the field is empty.
This method evaluates the value of the field. If the field contains no user input, it assigns the instructional text (ghost value) to be displayed. When the user types their own response, the script allows the custom input to override the ghost text.
Open your document in Adobe Acrobat Pro DC, navigate to the 'Tools' menu, and select 'Prepare Form' to enable form editing.
Right-click the specific text field where you want the ghost text to appear, and select 'Properties' from the context menu.
In the Properties dialog box, go to the 'Format' tab. Click the 'Select format category' dropdown menu and choose 'Custom'.
In the 'Custom Format Script' window, type the following code: if (event.value == "") event.value = "Your Instructions Here"; replacing the placeholder string with your desired text.
Switch to the 'Appearance' tab to set the text color (usually gray for placeholders). Save and preview the form to test the disappearing text functionality.

Create and Manage PDF Forms Easily with WPS Office
WPS Office offers a comprehensive, intuitive PDF editor designed to handle form creation, editing, and filling without the need to navigate complex scripting environments.
- 1. Open Your Document: Launch WPS Office and open your existing PDF file or create a new document from scratch.
- 2. Navigate to Form Tools: Click on the 'Form' tab located in the top navigation ribbon to access all interactive form options.
- 3. Insert or Edit Fields: Select 'Text Field' to draw a new fillable area, or double-click an existing field to adjust its properties.
- 4. Customize and Save: Modify the field appearance and functionality using the right-side properties panel, then save your fully interactive PDF.

Frequently Asked Questions
Will the ghost text print if I leave the form field empty?
Yes, using the standard format script method, the ghost text acts as the field's actual value when empty, meaning it will show up on printed copies. To prevent printing, you can set the field's visibility property to 'Visible but doesn't print' or use an additional print-trigger script to clear values.
Why isn't the ghost text disappearing when I click into the field?
A format script triggers based on the field's value status, not necessarily focus. If you want the text to vanish the moment a user clicks (focuses) on the field, you must implement an 'OnFocus' JavaScript action instead of a standard Custom Format script.
Do these custom JavaScript form fields work in browsers or mobile PDF viewers?
Not always. Advanced JavaScript form formatting is fully supported by dedicated desktop software like Adobe Acrobat or WPS Office. Basic web browser PDF viewers (like Chrome or Edge) or simplified mobile apps often lack full JavaScript execution support, which may prevent the ghost text logic from working.
How do I make the placeholder text gray but user input black?
The format script alone cannot change colors dynamically. You need to assign the text color to gray in the Appearance tab, and then add a Custom Keystroke script that changes the color property (event.target.textColor = color.black;) when the user starts typing.




