How to Copy a First Name to an Acrobat Form Field Automatically
Question details
To automatically extract the first word from a full client name field and populate it into a separate salutation or first-name field within a PDF form.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Designing an interactive PDF form where user input in one field dictates the automated entry in another field, specifically parsing a first name for greetings.
- Observed behavior
- The user seeks a method to avoid manual double-entry of a name by using an automated script that splits the full name input and forwards the first segment to a designated target text field.
Ensure you have a PDF editor with form creation and JavaScript validation capabilities, and make a note of the exact properties name of your target 'First Name' text field to avoid script errors.
Extract the First Name using JavaScript Validation
Apply a basic custom JavaScript to the original full name field. This script will detect the user's input, split the string at the first space, and copy the first word to your chosen field.
In Adobe Acrobat, form fields can utilize JavaScript to validate and format data instantly. By attaching a script to the primary name field, the document actively listens for input and modifies secondary fields without native calculation tools.
Launch your PDF file in Adobe Acrobat. Go to 'Tools' and select 'Prepare Form' to make your text fields editable.
Right-click on the 'Full Name' text field (the field where clients type their entire name) and select 'Properties' from the context menu.
Navigate to the 'Validate' tab within the Properties window. Check the option for 'Run custom validation script' and click the 'Edit' button.
Type the following script in the editor: this.getField("First Name").value = event.value.split(" ")[0]; Ensure that you replace "First Name" with the exact, case-sensitive title of your destination text field. Click 'OK' to save.
Close the Properties window and exit the form editing mode. Type a full name like 'John Doe' into the primary field and press Enter or click away. The target field should instantly populate with 'John'.

Create, Edit, and Fill PDF Forms with WPS PDF
If you are looking for an intuitive way to manage interactive PDF documents, WPS Office offers a comprehensive PDF Toolkit. You can easily design forms, modify text fields, and organize your files within a single, lightweight application.
- 1. Install WPS Office: Download and install the free version of WPS Office on your computer or mobile device.
- 2. Open your PDF: Launch WPS Office and choose 'PDF Edit' to open your existing interactive PDF form.
- 3. Use form tools: Navigate to the 'Form' tab on the ribbon to access tools for creating and editing fillable text fields.
- 4. Fill and save: Input your client data directly into the active fields. Once completed, you can save, flatten, or immediately export your PDF.

Frequently Asked Questions
Why is the script failing to copy the first name into the adjacent box?
The target field name inside your JavaScript (e.g., "First Name") must perfectly match the actual Name property of the destination text field. Field names are case-sensitive and capture exact spelling and spacing.
Can I alter the script to capture the last name instead?
Technically, yes. By adjusting the array index from [0] to the end of the split array, you can capture the last word entered. However, naming conventions varying significantly often makes automated last-name string extraction highly inaccurate without complex logic.
Are custom JavaScripts in PDF forms universally supported?
No. While full-featured desktop PDF editors like Adobe Acrobat will execute JavaScript form validations, many basic third-party web browsers or mobile PDF viewers omit JavaScript support, which causes these automated scripts to silently fail.




