How to Show Nonprinting Instructions and Validate Required PDF Form Fields
Question details
The user wants to display instructional placeholder text within PDF form fields that disappears when printed, and needs a way to alert users if mandatory fields are left blank before allowing them to print.

- Product
- Device & OS
- not provided
- Scenario
- Creating an interactive PDF form where users need guidance on what to type without printing the instructions, alongside enforcing completion of required fields before the document is printed.
- Observed behavior
- Standard PDF form features do not inherently stop the default Print command when required fields are empty, and static instructional text normally prints along with the user's input.
Ensure you are using a robust PDF editor that supports advanced form properties and JavaScript formatting, as these features are necessary to manipulate field behaviors.
Use Custom Format Scripts for Nonprinting Instructional Text
Apply a simple JavaScript snippet to the text field's format properties to display placeholder text that won't appear on the printed copy.
By dynamically changing the field's display property using JavaScript, the PDF can show helpful instructions on the screen but automatically hide them when the user sends the document to a printer.
Open your PDF in form editing mode, right-click the target text field, and select 'Properties'.
In the Properties dialog, select the 'Format' tab and choose 'Custom' from the Select format category dropdown menu.
In the Custom Format Script window, enter the following code: if (!event.value) { event.value = "Instructional text goes here"; event.target.display = display.noPrint; } else { event.target.display = display.visible; }
Click 'OK' to save the script, close the properties window, and test the field by typing text into it. The instruction will vanish when data is entered.

Create a Custom Print Button to Validate Fields
Because you cannot fully intercept the built-in PDF Print command, you must create a custom 'Print' button on the form that runs a validation script before executing the print job.
Create and Manage Advanced PDF Forms with WPS Office
WPS Office provides professional-grade PDF tools that allow you to easily create fillable forms, insert text fields, add interactive buttons, and manage advanced properties.
- 1. Open Your PDF: Launch WPS Office and open the PDF document you wish to transform into an interactive form.
- 2. Access Form Tools: Navigate to the 'Form' tab on the top ribbon to view all available interactive field options.
- 3. Insert and Customize Fields: Click on 'Text Field' or 'Push Button' to add elements to your page. Right-click the newly created fields to access 'Properties' for deep customization.
- 4. Save the Fillable PDF: Once your fields and buttons are set up, save the document. It is now ready for users to fill out.

Frequently Asked Questions
Why does the default Print shortcut bypass my required field validation?
The built-in Print command (such as Ctrl+P or File > Print) in PDF viewers operates at the application level and functions independently of form field rules. To enforce validation before printing, users must be directed to click a custom on-page Print button programmed with JavaScript.
Will checking the 'Required' box in field properties stop printing?
No. Checking the 'Required' property highlights the field and typically stops electronic form submission if left blank, but it does not prevent a user from printing the document. You must use JavaScript on a custom button to block printing.
What happens if a user disables JavaScript in their PDF reader?
If JavaScript is disabled, neither the nonprinting instructional text format scripts nor the custom print button validation will function. The form will fall back to the basic capabilities of the user's PDF viewer.
How do I prevent the custom print button from showing up on the printed paper?
Open the button's Properties, navigate to the General tab, and change the 'Form Field' property dropdown from 'Visible' to 'Visible but doesn't print'.




