PDF Editing Issues

How to Require a Confirmation Checkbox Before Submitting a PDF Form

Jason MillerJason Miller Oct 28, 2026 869 views

Question details

The user needs to validate a PDF order form to ensure a 'Confirm Order' checkbox is selected before the Submit button sends the email.

How to Require a Confirmation Checkbox Before Submitting a PDF Form
Product
PDF Form
Device & OS
not provided
Scenario
Creating an interactive PDF order form where users must explicitly check a confirmation box prior to submission.
Observed behavior
The form should display a warning message if the confirmation checkbox is not selected, and only execute the email submission if the box is checked.
Before you start

Ensure your PDF document already contains an interactive checkbox field and a standard button that you intend to use as the Submit button.

Solution 1Recommended

Add JavaScript Validation to the Submit Button

Use a custom JavaScript action on your submit button to check the state of the confirmation checkbox before executing the email function.

Interactive PDF forms allow you to use JavaScript to validate user input before triggering actions like emailing the document. By checking the string value of the checkbox field, you can conditionally send the email or display a warning alert to the user.

1
Open button properties

Enter form editing mode in your PDF editor, right-click the existing 'Submit Order' button, and select 'Properties'.

2
Add a JavaScript action

Navigate to the 'Actions' tab. Select 'Mouse Up' as the trigger, choose 'Run a JavaScript' from the 'Select Action' dropdown, and click the 'Add' button.

3
Enter the validation code

In the JavaScript editor, paste the following code: if (this.getField("ConfirmOrder").valueAsString == "Off") { app.alert("The Confirm Order checkbox must be selected before the order can be submitted.", 1); } else { this.mailDoc({cTo: "me@server.com", cSubject: "Subject line of the email", cMsg: "Email message body"}); }

4
Customize field names and email details

Replace 'ConfirmOrder' in the script with the exact name of your checkbox field. Update the 'cTo', 'cSubject', and 'cMsg' parameters with your target email address, desired subject line, and message body. Click 'OK' to save.

Add JavaScript Validation to the Submit Button
Testing your form: Switch out of form editing mode to test the button. Clicking it with the checkbox unchecked should trigger your alert popup, while checking the box should successfully open the user's default email client.
Efficient PDF Form Management

Create and Edit Interactive PDF Forms with WPS Office

WPS Office offers a comprehensive built-in PDF editor that allows you to easily design, fill, and manage interactive PDF forms without requiring complex external tools.

  1. 1. Open your PDF file: Launch WPS Office and open your existing PDF form or create a new document.
  2. 2. Access the Form tools: Navigate to the 'Form' tab on the top ribbon to view all interactive field options, including checkboxes and push buttons.
  3. 3. Edit and save: Use the intuitive interface to add or modify form fields, adjust their properties, and save your document for immediate use.
Easily insert text fields, checkboxes, and interactive buttons into your PDF documents.Seamlessly compatible with standard Adobe PDF formats, ensuring your forms work everywhere.A lightweight, all-in-one office suite that handles PDFs, documents, spreadsheets, and presentations for free.
microsoft office alternative - wps office

Frequently Asked Questions

Why does valueAsString return 'Off' for an unchecked box?

In PDF JavaScript, standard checkboxes default to an export value of 'Off' when they are unchecked, regardless of what their checked export value is (usually 'Yes' or 'On'). Checking valueAsString for 'Off' is the most reliable way to determine if a box is unselected.

How do I find the exact name of my checkbox field?

While in form editing mode, right-click the checkbox and select 'Properties'. The exact field name will be listed under the 'General' tab. You must use this exact name in your JavaScript code.

Can I validate multiple checkboxes before allowing submission?

Yes. You can chain multiple conditions in your JavaScript 'if' statement using the && (AND) operator. For example, check both fields to ensure they do not equal 'Off' before executing the this.mailDoc command.

Why isn't my submit button opening the email client after passing validation?

The mailDoc JavaScript function relies on the user's default desktop email client. If the user is opening the PDF in a web browser instead of a dedicated PDF reader, the browser's security settings will often block the action.