PDF Editing Issues

How to Hide PDF Form Fields When Emailing or Printing

Emma BrownEmma Brown Nov 3, 2026 869 views

Question details

The user needs to hide unselected or empty dropdown fields when emailing a completed PDF form, applying the same visibility rules that successfully hide them during printing.

How to Show or Hide PDF Form Fields When Printing and Emailing
Product
PDF
Device & OS
not provided
Scenario
Distributing a filled-out PDF form via email without showing empty form fields.
Observed behavior
Unselected dropdown fields are correctly hidden when the document is printed, but they remain fully visible when the same PDF is attached to an email.
Before you start

Ensure you have a PDF editor that supports advanced form creation and JavaScript, and save a backup copy of your original PDF form before modifying its code or structure.

Solution 1Recommended

Use a Custom Form Button with JavaScript

Standard email attachment actions bypass print-specific scripts. To apply visibility rules before emailing, you must create a dedicated 'Submit' or 'Email' button within the PDF that triggers a JavaScript visibility script before sending.

Because printing and emailing rely on different underlying actions, a script triggered by a 'Print' event will not execute when a user simply attaches the PDF to an email. Creating an interactive button inside the document forces the visibility script to run before packaging the file into an email message.

1
Add a Button Field

Open your PDF in form editing mode and insert a 'Button' field from the form controls menu onto your document.

2
Customize Button Properties

Right-click the new button and select 'Properties'. In the 'General' or 'Options' tab, label the button appropriately (e.g., 'Submit via Email').

3
Assign a JavaScript Action

Navigate to the 'Actions' tab within the properties window. Set the trigger to 'Mouse Up' and choose 'Run a JavaScript' as the action type.

4
Enter the Visibility and Email Code

Write or paste a JavaScript snippet that loops through your form fields, hides the unselected dropdowns, and then calls a method like `app.mailMsg()` or `doc.mailDoc()` to initiate the email draft with the updated document.

Use a Custom Form Button with JavaScript
Standard Email Actions: Attaching the PDF using your computer's native email client or dragging the file into an email window will not trigger internal PDF scripts. Users must click the custom button you created to ensure fields are hidden.

Create and Manage Interactive PDF Forms with WPS Office

WPS Office provides a comprehensive suite of PDF tools, allowing you to easily create, edit, and manage interactive forms with text fields, dropdowns, and custom buttons to optimize document sharing.

  1. 1. Open the PDF Form: Launch WPS Office and open your PDF document within the PDF editor.
  2. 2. Access Form Tools: Select the 'Form' tab from the top toolbar to reveal the interactive form controls.
  3. 3. Insert Interactive Elements: Click to insert push buttons, dropdown menus, or text fields directly onto your document.
  4. 4. Modify Field Properties: Double-click any form element to access its properties, where you can adjust visibility settings, labels, and default values.
Easily insert text fields, checkboxes, and interactive custom buttons into PDFsSupports advanced PDF form formatting and property managementFully compatible with standard PDF forms created in Adobe AcrobatLightweight, cross-platform PDF editor and reader
microsoft office alternative - wps office

Frequently Asked Questions

Why do hidden fields show up when I attach the PDF to an email?

Standard email attachment actions performed outside the PDF do not execute the PDF's internal formatting or printing scripts. To hide fields before emailing, you must trigger the email from within the PDF using a custom button and JavaScript.

Can I hide specific PDF form fields only during printing?

Yes. In the field properties under the 'General' tab, you can set the visibility property to 'Visible but doesn't print'. This requires no coding and ensures the field is hidden on paper.

Do I need programming knowledge to create interactive PDF forms?

Basic forms do not require coding. You can set simple visibility rules directly in the field properties using most PDF editors. However, complex actions like conditional hiding immediately prior to emailing do require basic JavaScript knowledge.