How to Populate Repeated PDF Form Fields from a Combo Box
Question details
The user needs to configure a PDF combo box script to update only the specific row's description and quantity fields rather than overwriting all repeating fields in the document.

- Product
- PDF Forms
- Device & OS
- not provided
- Scenario
- Creating dynamic PDF forms with repeating rows where a drop-down menu selection should auto-fill adjacent fields in the same row.
- Observed behavior
- The current combo box script populates every repeated description and quantity field across all rows instead of isolating the row associated with the selected item.
Verify that your PDF form fields follow a consistent naming convention. To target specific rows successfully, related fields must share sequential numbering suffixes, such as Combo.1, Description.1, and Quantity.1.
Use Dynamic Row Identifiers in Custom JavaScript
Modify your field names and JavaScript to dynamically extract the current row's number, allowing the script to update only the corresponding destination fields.
In PDF forms, fields with the exact same name are treated as a single entity, meaning a change to one updates them all. By assigning unique suffixes to fields in each row, your combo box script can identify its own row number and dynamically build the target field names.
Open your PDF in form editing mode. Right-click each field in the repeating row, select 'Properties', and rename them using a dot notation sequence (e.g., rename the first row to COMBO.1, DESCRIPTION.1, and QUANTITY.1).
Right-click the combo box (e.g., COMBO.1) and choose 'Properties'. Navigate to the 'Actions' tab, set the 'Select Trigger' to 'Mouse Up' or 'On Blur', and choose 'Run a JavaScript' from the 'Select Action' drop-down menu.
Click the 'Add' button and enter a script that splits the combo box name to extract the row identifier. For example: var rowNum = event.target.name.split('.')[1]; This reads the '.1' from COMBO.1.
Use the extracted row number to construct the target fields dynamically. Add code similar to: this.getField('DESCRIPTION.' + rowNum).value = 'Your Output'; Click 'OK' to save the script, then test the form.

Edit and Script PDF Forms Seamlessly with WPS Office
WPS Office provides a comprehensive suite of PDF tools, allowing you to easily add combo boxes, text fields, and custom JavaScript to build smart, interactive forms.
- 1. Open your PDF form: Launch WPS Office and open your PDF document containing the repeating rows.
- 2. Access the Form tools: Click on the 'Form' tab in the top navigation ribbon to reveal all interactive field editing options.
- 3. Configure combo box properties: Double-click your combo box to open the Properties menu. Go to the 'Actions' tab to easily insert your custom JavaScript for row-specific field targeting.

Frequently Asked Questions
Why does my PDF combo box update every field with the same name?
In PDF forms, if multiple fields share the exact same name, the software treats them as a single connected element. When a script updates one, all fields sharing that name are automatically updated.
How do I correctly name PDF form fields to indicate separate rows?
The standard practice is to use a dot notation format, such as FieldName.RowNumber (e.g., QUANTITY.1, QUANTITY.2). This makes it easy for JavaScript to split the field name at the dot and identify the specific row index.
Can I use wildcards to target a specific row in a PDF script?
No, wildcards alone cannot isolate a specific row in PDF JavaScript. You must explicitly build the destination field's string name by concatenating the base field name with the dynamically extracted row number.




