PDF Editing Issues

Show an Acrobat PDF Submit Button When Two Fields Are Filled

Khadija KhanKhadija Khan Nov 19, 2026 868 views

Question details

Show a PDF form's Submit button only when at least two of three contact fields contain values.

Show an Acrobat PDF Submit Button When Two Fields Are Filled
Product
Adobe Acrobat PDF forms
Device & OS
not provided
Scenario
A fillable PDF contains address, phone, and email fields and a Submit button.
Observed behavior
The Submit button should be visible when any two or all three fields are filled and hidden otherwise.
Before you start

Open the PDF in Acrobat and use Prepare a form to check the exact names of the three text fields and the Submit button. Make sure Acrobat JavaScript and automatic form calculations are enabled in Preferences.

Solution 1Recommended

Use an Acrobat calculation script to control the Submit button

Count the nonempty contact fields after a form value changes and show the button when the count reaches two.

This script checks whether fields contain non-whitespace text; it does not verify that the address, phone number, or email is valid. The button still needs its own submit action.

1
Check field names

In Acrobat, open All tools > Prepare a form. Confirm the contact fields are named address, phone, and email and the button is named Submit, or replace those names in the script with your actual field names.

2
Set the button's initial visibility

Open the Submit button's Properties, select the General tab, and set Form Field to Hidden. On the Actions tab, confirm that the button has the intended Submit a form action.

3
Add a calculation field

In Prepare a form, add a text field named contactCount. Open its Properties, set Form Field to Hidden on the General tab, and select Custom calculation script on the Calculate tab.

4
Enter the script

Click Edit next to Custom calculation script and enter: var names = ["address", "phone", "email"]; var count = 0; for (var i = 0; i < names.length; i++) { var value = this.getField(names[i]).valueAsString; if (value.replace(/^\s+|\s+$/g, "") !== "") count++; } this.getField("Submit").display = count >= 2 ? display.visible : display.hidden; event.value = count;

5
Test the form

Save the PDF and use Preview in Prepare a form. Fill and leave each field to commit its value: the button should appear for any two filled fields, including phone and email, and disappear when fewer than two remain.

Use an Acrobat calculation script to control the Submit button
PDF viewer support: Dynamic visibility depends on Acrobat form JavaScript and calculation support. Some PDF viewers may not run the script. If the PDF opens with previously filled values, edit and commit a field to trigger recalculation.
Free Microsoft Office alternative

Work with PDF forms and Office files in WPS Office

WPS Office is a free, lightweight alternative with a familiar interface for working with Office documents and viewing PDFs. It can help you move between common file formats, but the Acrobat-specific button script should be created and tested in Acrobat.

View PDF forms alongside your other documentsOpen common Microsoft Office formats, including DOCX, XLSX, and PPTXUse a familiar interface to transition from Microsoft OfficeStart with free tools in a lightweight office suite
microsoft office alternative - wps office

Frequently Asked Questions

Will the button appear if only phone and email are filled?

Yes. The calculation counts all three named fields equally, so any pair of nonempty fields makes the Submit button visible.

What happens if a field contains only spaces?

The script removes leading and trailing whitespace before counting, so a field containing only spaces does not count as filled.

Does showing the button automatically submit the form?

No. In Prepare a form, open the button's Properties and use the Actions tab to configure the appropriate Submit a form action.

Why isn't the button changing when I fill in fields?

Check that the field names in the script match those in Prepare a form, then check Acrobat Preferences for JavaScript and automatic form calculation settings. Leave the edited field to commit its value and test again.

Will the visibility rule work in every PDF viewer?

Not necessarily. The rule uses Acrobat form JavaScript, which some PDF viewers do not support. Test the saved form in the viewer your recipients will use.