How to Auto-Append a Domain to an Email Field in Acrobat
Question details
Configure a PDF form email field so that a fixed domain is automatically added after the user types their mailbox name.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Creating an interactive PDF form for a specific organization where respondents only need to input their unique mailbox name, and the company domain is attached automatically.
- Observed behavior
- Attempting to use an arbitrary text mask fails because mailbox names have varying character lengths, which breaks the fixed-character requirement of the mask.
Ensure your PDF editor supports JavaScript for form fields, and that you have the exact domain name (e.g., @company.com) ready to insert into the script.
Apply a Custom Format JavaScript to the Text Field
Using a custom format script dynamically appends the domain to any mailbox name regardless of its character length, replacing the rigid limitations of an arbitrary mask.
Arbitrary masks in Acrobat require a predetermined, fixed number of characters before a specific symbol. Since email prefixes (mailbox names) vary widely in length, an arbitrary mask is unsuitable for this task. The optimal approach is to use a simple JavaScript formatting rule that triggers once the user exits the field.
Open your document in Adobe Acrobat. Go to 'Tools' and select 'Prepare Form' to enable field editing.
Right-click on the target email text field and select 'Properties' from the context menu.
Navigate to the 'Format' tab. Click the 'Select format category' dropdown menu and choose 'Custom'.
In the 'Custom Format Script' text box, enter the following code: event.value = event.value + "@company-name.com"; (replace company-name.com with your actual domain).
Click 'Close' to save the properties. Click 'Preview' at the top right, type a name into the field, and press Tab or click outside the field to see the domain append automatically.

Create and Manage PDF Forms Easily with WPS Office
WPS Office includes a robust built-in PDF editor that allows you to easily create, edit, and manage interactive PDF forms while maintaining full compatibility with standard document formats.
- 1. Open PDF in WPS Office: Launch WPS Office and open your existing PDF document or create a new one from scratch.
- 2. Access Form Tools: Navigate to the 'Form' tab on the top ribbon to reveal the interactive form creation menu.
- 3. Add Text Fields: Click on 'Text Field' and drag your cursor over the document page to position the input area for respondents.
- 4. Adjust Properties: Double-click the newly inserted text field to rename it, adjust font sizes, or set character limits.
- 5. Save and Distribute: Save your document to lock in the form fields. The resulting PDF can be filled out by anyone using a standard PDF reader.

Frequently Asked Questions
Why shouldn't I use an arbitrary mask for email fields in PDF forms?
Arbitrary masks dictate a strict pattern of characters. For example, if you set a mask for exactly 6 characters before the '@' symbol, a user named 'Jon' (3 characters) or 'Michael' (7 characters) will trigger an error. Custom format scripts bypass this by evaluating the input dynamically.
Will the appended domain appear in my exported form data?
Yes. Because the script alters the actual 'event.value' of the field, the appended domain becomes part of the final data. When you export or submit the form, the complete email address will be recorded.
What happens if a user types the domain themselves?
If you only use the basic append script, the field will blindly add the domain again, resulting in an error like 'name@company.com@company.com'. To prevent this, you can use a more advanced script that checks if 'event.value.indexOf("@")' is greater than -1 before appending.
Can I hide the appended domain until the PDF is printed?
Format scripts trigger immediately when the field loses focus, so the user will see it on screen. If you only want it appended upon printing or submitting, you would need to use a separate hidden field that combines the inputs using a calculation script instead.




