Clear Default Text on Focus in an Adobe Acrobat PDF Form Field
Question details
Set a PDF form field to clear its default instructional text when the field receives focus.

- Product
- Adobe Acrobat PDF form editor
- Device & OS
- not provided
- Scenario
- A form author wants instructional text to disappear when a user clicks a text field.
- Observed behavior
- The field should start with instructional text and clear it when the user focuses the field.
Open the PDF in a form editor that supports field actions and JavaScript, such as Adobe Acrobat. Identify the text field and the exact instructional text you want to display.
Add an On Focus JavaScript action to the PDF field
Use a field action to clear the displayed value when a user clicks into the field.
In Adobe Acrobat, open the PDF and select All tools > Prepare a form.
Double-click the text field, open the Options tab, and enter the instruction in Default Value.
In the field's Properties dialog, open Actions. Select On Focus as the trigger and Run a JavaScript as the action, then click Add.
Enter event.target.value = ""; in the JavaScript editor, then confirm the action and close the field properties.
Save the PDF, exit form editing, and click the field. Type a value, click outside it, and click back in to check the focus and blur behavior.

View and fill PDF forms alongside your Office documents with WPS Office
WPS Office is a free, lightweight alternative for working with Office files and PDFs in a familiar interface, making it easy to move between document formats. Use a PDF editor that supports JavaScript field actions to configure automatic clearing; WPS Office is an alternative for viewing and filling the form.

Frequently Asked Questions
How do I keep the script from deleting a user's answer?
In the field's On Focus JavaScript action, check whether event.target.value matches the exact instructional text before clearing it. This leaves other values unchanged.
Will the instruction return if the user leaves the field empty?
No. The On Focus script only clears the value. Restoring the instruction requires additional logic, such as a separate blur action.
Why doesn't the field clear in my PDF viewer?
The viewer may not support PDF JavaScript or may have it disabled or restricted. Test the saved form in a viewer that supports JavaScript field actions and check its security settings.
Where do I change the default instructional text?
In Adobe Acrobat, select All tools > Prepare a form, double-click the text field, and change Default Value on the Options tab. If your script checks for a specific instruction, update the script to match it.




