PDF Editing Issues

Copy Multiline PDF Form Entries to Separate Fields in Adobe Acrobat

Huda QurayshiHuda Qurayshi Nov 19, 2026 869 views

Question details

Copy each entered line from a multiline Prescription field into the corresponding PDF form field, FADM1 through FADM8.

Copy Multiline PDF Form Entries to Separate Fields in Adobe Acrobat
Product
Adobe Acrobat PDF forms
Device & OS
not provided
Scenario
A PDF form contains a multiline Prescription field and eight sequential destination fields.
Observed behavior
Each explicit line of the source field should appear in its matching destination field, with unused destination fields cleared.
Before you start

Open the form in Adobe Acrobat Pro and confirm that the source field is named Prescription and the destination fields are named FADM1 through FADM8. Ensure Prescription is a multiline text field, and test the script with non-sensitive sample data before using medical information.

Solution 1Recommended

Add a validation script to the Prescription field

Use this method to update the destination fields when a change to Prescription is committed.

The script uses explicit line breaks, not visual wrapping, to separate entries. Blank lines keep their positions, so a blank second line leaves FADM2 blank.

If there are more than eight lines or a destination field is missing, the script rejects the edit and leaves the existing destination values unchanged.

1
Open the field properties

In Adobe Acrobat Pro, open the PDF and select All tools > Prepare a form. Double-click the Prescription field to open its properties.

2
Add the validation script

On the Validate tab, select Run custom validation script and click Edit. Paste this script: var text = String(event.value); var lines = text.split(/\r\n|\r|\n/); var fields = []; var i; if (lines.length > 8) { app.alert("Enter no more than eight lines."); event.rc = false; } else { for (i = 1; i <= 8; i++) { var field = this.getField("FADM" + i); if (!field) { app.alert("Missing destination field: FADM" + i); event.rc = false; break; } fields.push(field); } if (event.rc !== false) { for (i = 0; i < 8; i++) { fields[i].value = i < lines.length ? lines[i] : ""; } } }

3
Save and test the form

Click OK to close the script editor and field properties, then save the PDF. Exit form editing, enter sample lines in Prescription, and click another field to commit the entry. Check FADM1 through FADM8, then test blank lines, fewer than eight lines, and more than eight lines.

Add a validation script to the Prescription field
Verify medical entries: The script copies by line position; it cannot determine whether an entry belongs in a particular medical field. Review every destination field before the form is used or shared.
Work with PDF forms

Fill the destination PDF fields manually in WPS Office

For a compatible fillable PDF, use WPS Office to copy each Prescription line into its matching destination field manually. This is an alternative to JavaScript automation, not a way to add the validation script.

  1. 1. Open the PDF: Open WPS Office, select Open, and choose the fillable PDF.
  2. 2. Check the form fields: Click the Prescription field and each destination field to confirm that the PDF allows you to enter or edit text.
  3. 3. Copy the lines: Select and copy each line from Prescription, then paste it into the corresponding field from FADM1 through FADM8. Clear any unused destination fields.
  4. 4. Review and save: Compare every destination field with the source, then select File > Save As to save the completed PDF.
Fill and review individual PDF form fieldsKeep each prescription line matched to its intended destinationOpen and edit compatible Microsoft Word, Excel, and PowerPoint formats
microsoft office alternative - wps office

Frequently Asked Questions

Does a visually wrapped line count as a separate entry?

No. The script splits text only at explicit line breaks entered in the Prescription field. Press Enter to start a new destination entry.

What happens if I enter more than eight lines?

The validation script displays an alert and rejects the edit. Reduce the entry to eight lines or fewer; the existing destination values remain unchanged until a valid edit is committed.

Will a blank line shift the remaining entries?

No. A blank line occupies its own position. For example, a blank second line leaves FADM2 empty and places the third line in FADM3.

Why did the destination fields not update?

In Acrobat Pro, check the exact field names under All tools > Prepare a form and confirm that the script is on the Prescription field's Validate tab. Also check whether the PDF viewer supports form JavaScript and allows it to run.

Can the script verify that prescription information is in the correct field?

No. It copies by line position only. Check the source and all destination fields manually, especially when a line is blank or missing.