How to Run a PDF Form Confirmation Action Only After Submission Succeeds
Question details
The user needs to configure a PDF form so that a secondary confirmation action, such as opening a webpage, executes only if the form submission is successful and required fields are validated.

- Product
- PDF Editors
- Device & OS
- not provided
- Scenario
- Creating an interactive PDF form with a submit button that performs multiple actions (submitting data and redirecting the user).
- Observed behavior
- The secondary action (opening a confirmation webpage) runs automatically even if the initial submission action fails due to incomplete required fields.
Identify all required fields in your PDF document and ensure your PDF editing software supports custom JavaScript actions for interactive forms.
Use Custom JavaScript for Form Validation and Submission
Replace basic sequential button actions with a controlled JavaScript workflow that validates fields before executing the submission and confirmation.
When you assign multiple actions to a single PDF button, standard PDF viewers execute them in order without checking if the previous action was successful. If a user clicks 'Submit' but misses a required field, the built-in validation stops the submission, but the button still proceeds to the next action (like opening a URL).
To prevent users from seeing a success page when their submission actually failed, you must control the logic with JavaScript or handle the redirection entirely on your server.
Right-click your Submit button, select Properties, and navigate to the Actions tab. Delete any existing 'Submit a form' or 'Open a web link' actions from the list.
From the 'Select Action' dropdown menu, choose 'Run a JavaScript' and click the 'Add' button.
In the JavaScript editor, write a script to check if your required fields are filled. For example: `if (this.getField('Email').value !== '') { // proceed } else { app.alert('Please fill out all required fields.'); }`.
Inside the success condition of your script, add your submission command (e.g., `this.submitForm({cURL: 'YOUR_SERVER_URL'});`) followed by the redirect command (e.g., `app.launchURL('YOUR_CONFIRMATION_URL');`).

Create and Manage Interactive PDF Forms with WPS Office
WPS Office provides comprehensive PDF editing tools, allowing you to create fillable forms, manage button actions, and handle document workflows seamlessly.
- 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 like text fields and buttons.
- 3. Configure Button Properties: Double-click your submit button to open its Properties dialog, then use the Actions tab to define precise form behaviors.

Frequently Asked Questions
Why does the confirmation page open even if I leave required fields blank?
By default, PDF viewers execute multiple button actions sequentially without checking the success or failure of preceding actions. If the submit action fails due to missing fields, the viewer still moves on to the next assigned action, which is opening the webpage.
Can I use standard button actions instead of JavaScript to fix this?
Standard button actions do not support conditional logic. To run an action only upon successful submission, you must either use JavaScript to validate the fields first or handle the redirect on your server-side script.
What is the best way to handle PDF form confirmations?
The most robust method is server-side redirection. Configure your PDF button to only submit the form data to your server URL. Your web server should then process the data and respond directly with the confirmation webpage.




