How to Auto-Append Default Text to PDF Form Fields in Acrobat
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.

- 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.
Ensure you are using a PDF editing application that supports form field properties and custom JavaScript formatting, such as Adobe Acrobat Pro.
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.
Open your PDF document in Adobe Acrobat, navigate to the Tools menu, and select 'Prepare Form' to enable form editing.
Right-click the specific text field you want to modify and select 'Properties' from the context menu.
In the Properties window, click on the 'Format' tab. From the 'Select format category' drop-down menu, choose 'Custom'.
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.
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.

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. Open WPS PDF: Launch WPS Office and switch to the 'PDF' tab to access the integrated PDF reader and editor.
- 2. Load Your PDF Form: Open your interactive PDF form document directly within the application.
- 3. Fill and Manage Data: Navigate to the 'Form' tab to interact with text fields, checkboxes, and drop-down menus seamlessly.
- 4. Save and Share: Save your updated PDF document, ensuring full data retention and compatibility with all major PDF viewers.

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.




