How to Autofill Company Names Throughout a PDF Form
Question details
The user wants to enter a company name once in a PDF form and have it automatically populate in multiple flowing text fields throughout the document.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Creating a dynamic PDF form where repeated information (such as a company name) only needs to be typed once by the user to appear in several different text blocks.
- Observed behavior
- The user needs to display the inputted company name dynamically within a larger block of text so that the surrounding words flow naturally around the length of the name.
Ensure your PDF editor supports JavaScript and form field calculations, as these features are necessary to dynamically combine flowing text with form field inputs.
Use a Calculation Script in a Multiline Text Field
Set up a primary input field and use a custom JavaScript calculation in a read-only multiline field to automatically combine the flowing text with the inputted company name.
If the surrounding text must flow automatically based on the length of the company name, it must be configured as part of a single multiline field. Rich text formatting is generally not required unless the company name specifically needs a different color or font style.
Add a standard text field to your PDF form and name it exactly 'CompanyName'. This is the field where the user will type the company name.
Create a second text field where the paragraph of text will appear. In the field properties, set it to 'Read Only' and check the 'Multi-line' option.
Navigate to the 'Calculate' tab in the second field's properties. Select 'Custom calculation script' and enter the following JavaScript code: var companyName = this.getField("CompanyName").valueAsString; event.value = "This is some text.\nThis is a new line of text.\nThe company's name is " + companyName + ".\nLast line of text.";
Save your PDF and type a name into the 'CompanyName' field. Click outside the field to trigger the calculation and watch the second field automatically update.
Draft the Document in Word or InDesign
If managing JavaScript in a PDF is too complex, you can set up linked fields in a word processor or design software before finalizing the document.
Create Interactive PDF Forms Easily with WPS Office
WPS PDF provides powerful and intuitive tools to create, edit, and manage interactive PDF forms. You can easily add text fields, checkboxes, and set up your documents for seamless data entry.
- 1. Open PDF in WPS Office: Launch WPS Office and open your existing PDF document or create a new blank PDF.
- 2. Navigate to the Form Tab: Click on the 'Form' tab on the top ribbon to access all interactive form creation tools.
- 3. Insert Text Fields: Select 'Text Field' and click on your document to insert fillable boxes for the company name and other required details.
- 4. Adjust Properties: Right-click the inserted field and select 'Properties' to rename the field, duplicate it across pages, or set it as read-only.

Frequently Asked Questions
Why isn't the company name updating in the second field automatically?
Ensure that your PDF viewer supports JavaScript and that JavaScript is enabled in your software preferences. Also, double-check that the field name referenced in your calculation script perfectly matches the actual Name property of the input text field (e.g., 'CompanyName').
Can I mirror form fields without using any JavaScript?
Yes. If you simply need the exact same text to appear in multiple places (without surrounding flowing text), you can copy and paste the text field. Giving multiple text fields the exact same Name property will automatically mirror the input across all of them.
How do I make the flowing text adjust to a very long company name?
By keeping the surrounding text and the dynamically inserted company name within a single text field (combined via the calculation script), the text will naturally flow and wrap to the next line based on the field's dimensions. Ensure the target field has the 'Multi-line' option checked.




