How to Create an Email CC List from Acrobat Form Checkboxes
Question details
The user needs to collect email addresses from selected PDF checkboxes to dynamically generate an email CC list and send the form using JavaScript.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Setting up a PDF form to automate an email submission process where specific recipients are copied based on which checkboxes the user selects.
- Observed behavior
- A JavaScript snippet is required to extract the export values of checked boxes, ignore unchecked 'Off' states, construct an email subject, and execute the this.mailDoc function.
Ensure that the 'Export Value' of each checkbox in your PDF form properties is explicitly set to the corresponding recipient's email address, rather than the default 'Yes'.
Use an Array Push Method for the CC List
This method stores valid checked values in an array and joins them with semicolons, creating a clean, error-free CC string for the mailDoc function.
By utilizing an array, the script avoids trailing semicolons in the email address string, which can cause submission errors in some email clients.
Right-click the Submit button on your PDF form, select 'Properties', and navigate to the 'Actions' tab.
Set 'Select Action' to 'Run a JavaScript' and click the 'Add' button to open the JavaScript editor.
Declare an array of your field names (e.g., var fields = ['MD', 'HR'];). Create a 'for' loop to iterate through the fields, using this.getField(fields[i]).value to extract the selection.
Add an 'if' statement checking that the value is not 'Off' (if (value !== 'Off' && value !== '')). If true, push the value into a new array called 'cc'.
Use this.mailDoc({bUI:true, cCc:cc.join(';'), cSubject:'Completed Form', cMsg:'Please review.'}) to open the email client with the joined array values.

Build Custom Subject and Message Content via String Concatenation
Expands the basic script to pull user data from other form fields (like Name and Date) to dynamically personalize the email subject and body text.
Create and Edit Interactive PDF Forms with WPS Office
WPS Office provides powerful PDF editing capabilities, allowing you to easily create fillable forms, configure checkbox export values, and assign custom JavaScript actions to buttons.
- 1. Open PDF in WPS: Launch WPS Office and open your PDF document using the built-in WPS PDF editor.
- 2. Access Form Tools: Navigate to the 'Form' tab on the top ribbon to view all interactive form controls.
- 3. Configure Checkboxes: Double-click a checkbox to open its Properties. Go to the 'Options' tab and set the 'Export Value' to the target email address.
- 4. Add JavaScript Action: Double-click your Submit button, go to Properties > Actions, choose 'Run a JavaScript', and paste your email routing script.

Frequently Asked Questions
Why does my script return 'Off' instead of an email address?
In standard PDF forms, 'Off' is the default system value for an unchecked checkbox. Your JavaScript must explicitly check if the field value is not equal to 'Off' before appending it to your email list.
How do I change the export value of a PDF checkbox?
Right-click the checkbox and select Properties. Navigate to the Options tab, locate the 'Export Value' field, and replace the default 'Yes' with the specific email address you want to trigger when checked.
Why is the mailDoc function not opening my email client?
The mailDoc function relies on the operating system's default desktop email client (such as Outlook or Apple Mail). If you rely entirely on webmail or if your PDF reader's security settings restrict email integration, the script may fail to execute.
Can I bypass the email confirmation prompt when submitting?
Setting the bUI parameter to false in the this.mailDoc() method attempts to suppress the user interface prompt. However, modern PDF security settings will often still trigger a secondary security warning to prevent malicious silent emails.




