How to Add CC Email Addresses Based on Acrobat PDF Radio Buttons
Question details
The user needs to automatically route a PDF form submission to specific CC email addresses depending on which radio buttons (like Yes or No) are selected by the person filling out the form.

- Product
- Adobe Acrobat PDF
- Device & OS
- not provided
- Scenario
- Setting up an interactive PDF form that submits data via email and requires dynamic CC routing based on the user's radio button choices.
- Observed behavior
- The user is looking for a JavaScript solution to map radio button values to an array of CC email addresses before executing the document submission method.
Verify the exact export values of your radio buttons in the field properties (e.g., ensuring 'Yes' is capitalized correctly), as JavaScript conditions are case-sensitive.
Build a CC Array Using Acrobat JavaScript Before Calling mailDoc
Implement a custom JavaScript action on your submit button to check radio button values, populate a CC address array dynamically, and trigger the email submission.
When dealing with conditional email routing in PDF forms, you can collect the required email addresses in an array by validating the export value of each radio button group. Once the array is populated, join the addresses into a single string separated by semicolons to pass into the mailDoc method.
Open your PDF in form editing mode, right-click the submission button, and select Properties.
Navigate to the Actions tab, choose 'Mouse Up' as the trigger, select 'Run a JavaScript' from the Select Action dropdown, and click Add.
In the JavaScript Editor, begin by declaring an empty array to store your conditional CC addresses: var ccAddresses = [];
Check the value of your radio buttons and push the corresponding email to the array. For example: if (this.getField('Contract Hire').valueAsString == 'Yes') ccAddresses.push('address1@server.com');
Call the mailDoc function using the joined array for the CC parameter: this.mailDoc({bUI: true, cTo: 'main@server.com', cCc: ccAddresses.join(';'), cSubject: 'Form Submission', cMsg: 'Body text'});

Create and Manage Interactive PDF Forms with WPS Office
While writing custom JavaScript for email routing can be complex, WPS Office provides an intuitive, user-friendly PDF Editor to build fillable forms, add interactive radio buttons, and streamline your data collection process effortlessly.
- 1. Open WPS PDF: Launch WPS Office and open your PDF document using the built-in PDF Editor.
- 2. Access Form Tools: Navigate to the 'Form' tab on the top ribbon to access interactive form controls.
- 3. Insert Radio Buttons: Click on 'Radio Button' and place it on your document. Double-click to set its export values and properties.
- 4. Configure Submission: Add a 'Push Button', set its action to 'Submit a form', and define your destination email address.

Frequently Asked Questions
Why aren't my CC email addresses appearing in the generated email?
This usually happens if the radio button's export value does not exactly match the value checked in your JavaScript (e.g., 'Yes' vs 'yes'). Double-check the field properties in your PDF editor.
Can I add multiple emails to a single condition?
Yes, you can push multiple emails to the array within the same if statement, or push a single string with multiple emails separated by semicolons (e.g., 'email1@test.com;email2@test.com').
Does this JavaScript work in all PDF viewers?
No, custom JavaScript actions like mailDoc are generally supported in full desktop programs like Adobe Acrobat or professional PDF editors, but they may be disabled or ignored in basic web browser PDF viewers or mobile apps.
How do I join the array elements properly for the CC field?
Use the .join(';') method on your array. Most email clients require multiple addresses to be separated by a semicolon in order to route the emails correctly.




