PDF Editing Issues

How to Auto-Append Default Text to PDF Form Fields in Acrobat

John WilsonJohn Wilson Oct 28, 2026 869 views

Question details

The user wants to automatically append specific default text, such as a company domain (@company.com), to the data entered into a PDF form field after the user finishes typing and leaves the field.

How to Auto-Append Default Text to PDF Form Fields
Product
Adobe Acrobat PDF Forms
Device & OS
not provided
Scenario
Creating or modifying an interactive PDF form where users need to input repetitive data, such as email addresses, and the form creator wants to automate the domain entry.
Observed behavior
The form field needs to dynamically update its value to include the predefined text string upon losing focus, without duplicating the appended text if the field is edited multiple times.
Before you start

Ensure you are using a PDF editing application that supports form field properties and custom JavaScript formatting, such as Adobe Acrobat Pro.

Solution 1Recommended

Use a Custom Format JavaScript to Append Text

Apply a simple JavaScript code within the text field's properties to automatically add the desired string when the user finishes typing.

Using JavaScript in PDF forms allows for dynamic data formatting. By adding a custom format script to the text field, you can ensure that a specific string, such as a company email domain, is seamlessly appended to whatever the user types.

1
Enter Prepare Form Mode

Open your PDF document in Adobe Acrobat, navigate to the Tools menu, and select 'Prepare Form' to enable form editing.

2
Access Field Properties

Right-click the specific text field you want to modify and select 'Properties' from the context menu.

3
Set Custom Format

In the Properties window, click on the 'Format' tab. From the 'Select format category' drop-down menu, choose 'Custom'.

4
Enter the JavaScript

In the 'Custom Format Script' box, enter the following code: if (event.value && event.value.indexOf("@company.com") === -1) event.value += "@company.com";. Replace "@company.com" with your specific default text.

5
Save and Test

Click 'Close' to save the properties. Exit Prepare Form mode and test the field by entering text and clicking outside the field to verify the domain is appended correctly.

Use a Custom Format JavaScript to Append Text
Preventing Duplicate Text: The indexOf condition in the script ensures that the default text is not added multiple times if the user clicks back into the field and modifies their input.
Edit PDF Forms Easily

Manage and Fill PDF Forms Seamlessly with WPS Office

WPS Office offers a comprehensive PDF editor that allows you to effortlessly interact with fillable forms, edit PDF text, and manage document properties without requiring expensive software subscriptions.

  1. 1. Open WPS PDF: Launch WPS Office and switch to the 'PDF' tab to access the integrated PDF reader and editor.
  2. 2. Load Your PDF Form: Open your interactive PDF form document directly within the application.
  3. 3. Fill and Manage Data: Navigate to the 'Form' tab to interact with text fields, checkboxes, and drop-down menus seamlessly.
  4. 4. Save and Share: Save your updated PDF document, ensuring full data retention and compatibility with all major PDF viewers.
Fully compatible with standard PDF forms and Adobe Acrobat documents.Easily insert text fields, checkboxes, and interactive elements into your PDFs.Lightweight, fast, and completely free for standard PDF reading and filling tasks.
microsoft office alternative - wps office

Frequently Asked Questions

Can I append different text to different fields using this method?

Yes, you can apply unique custom format scripts to individual text fields. Simply change the appended string (e.g., '@domain.com' or ' USD') in each specific field's Format properties.

Why is the default text appearing multiple times in my PDF form field?

This happens if you use a basic append script without a validation check. To fix it, ensure your script includes the indexOf condition to verify if the text already exists before appending it again.

Does this custom JavaScript work on mobile PDF readers?

Many basic mobile PDF readers do not fully support custom JavaScript formatting. For the best experience and to ensure the script triggers correctly, users should fill out the form using robust desktop applications like Adobe Acrobat or WPS Office.