PDF Editing Issues

How to Validate Selected PDF Form Fields With a Custom Submit Button

Phi Hung VoPhi Hung Vo Nov 3, 2026 869 views

Question details

The user needs to configure a secondary submit button in a PDF form that only validates a specific subset of fields (Name, Employee Number, and Date) prior to sending the form for manager approval.

How to Validate Selected PDF Form Fields With a Separate Submit Button
Product
PDF
Device & OS
not provided
Scenario
Setting up a PDF form for a multi-step manager approval workflow where different submit buttons require different fields to be validated.
Observed behavior
The default submit action validates all fields marked as 'required', which prevents the secondary button from executing if unneeded fields are left blank. A custom solution is required to bypass global validation and check specific fields.
Before you start

Ensure you have access to a PDF editor that supports adding JavaScript to interactive forms, and write down the exact case-sensitive field names for the fields you want to validate.

Solution 1Recommended

Use JavaScript to Validate Specific Fields Before Submission

Assign a custom JavaScript action to your secondary submit button to check the specific fields and execute the submission only if those fields contain data.

Using a custom JavaScript action allows you to bypass standard PDF required field validation. By doing this, you can target only the fields necessary for this specific workflow step without making the fields globally mandatory.

1
Open Button Properties

In your PDF form editing mode, right-click the secondary manager-approval submit button and select 'Properties'.

2
Navigate to the Actions Tab

Go to the 'Actions' tab. Select 'Mouse Up' as the trigger event, and choose 'Run a JavaScript' from the 'Select Action' dropdown menu.

3
Enter the Validation Script

Click 'Add' and input a script that checks your specific fields. Define an array with your field names (e.g., ['Name', 'Employee Number', 'Date']), loop through them to check if 'this.getField(fieldName).value' is empty, and display an alert message if any required field is missing.

4
Add Form Submission Logic

In the same script, add a condition that executes 'this.submitForm({cURL: "mailto:manager@example.com", cSubmitAs: "PDF"})' only if all the checked fields contain valid data. Click OK to save and then test your button.

Use JavaScript to Validate Specific Fields Before Submission
Field Name Accuracy: Ensure the field names in your JavaScript match the actual names in your PDF form exactly, as JavaScript is strictly case-sensitive.
Seamless PDF Editing

Easily Manage Interactive PDF Forms with WPS Office

WPS Office provides robust PDF editing capabilities, allowing you to fill, sign, and manage interactive forms. Streamline your document workflows effortlessly with a lightweight and user-friendly interface.

  1. 1. Open PDF in WPS: Launch WPS Office and open your interactive PDF document.
  2. 2. Access Form Filling Tools: Navigate to the 'Fill & Sign' or Form tab in the top ribbon to interact with the form controls.
  3. 3. Input Data Seamlessly: Click on the designated text boxes, checkboxes, or dropdowns to enter the required manager approval information.
  4. 4. Save and Distribute: Save your completed interactive PDF form to securely share with your team or manager.
Easily fill text fields, checkboxes, and interactive buttons in PDFsFully compatible with standard PDF forms and Adobe Acrobat formatsLightweight, fast, and user-friendly interface for seamless editingBuilt-in digital signature tools for approval workflows
microsoft office alternative - wps office

Frequently Asked Questions

Can I validate different fields with multiple submit buttons in the same PDF?

Yes. To achieve this, do not mark the fields as 'required' in their standard properties. Instead, use custom JavaScript on each separate submit button to validate only the fields relevant to that specific button's function before executing the submit command.

Why isn't my JavaScript validation script working?

Common issues include typos in the exact field names (JavaScript is case-sensitive), syntax errors in the code loop, or PDF viewer settings that have disabled JavaScript execution for security reasons.

Does WPS Office support filling out interactive PDF forms?

Yes, WPS Office fully supports filling, saving, and printing interactive PDF forms, making it an excellent tool for handling documents with text fields, checkboxes, dropdowns, and basic submit actions.