How to Populate Multiple PDF Form Fields from a Selected Table
Question details
The user needs to create an interactive PDF form that allows users to select a schedule and automatically copy the chosen time range into the appropriate day fields for a two-week work schedule.

- Product
- Adobe Acrobat / PDF
- Device & OS
- not provided
- Scenario
- Building a two-week work schedule PDF form where clicking a time range button routes the specific schedule data into designated daily text fields based on a checkbox selection.
- Observed behavior
- Requires a method to link schedule buttons to specific target day fields so the selected time ranges are accurately copied over via form actions.
Ensure you are using a PDF editor that supports advanced form creation and custom JavaScript actions, such as Adobe Acrobat Pro or WPS Office. Back up your original PDF file before embedding new scripts to prevent accidental data loss.
Use Consistent Naming and JavaScript Actions
By pairing identically named checkboxes with uniquely named daily text fields, you can use a JavaScript Mouse Up action to route the selected schedule data accurately.
The core logic relies on using consistent field naming conventions. The checkbox acts as a selector to identify the target day, and the button contains the script that pushes the value to the selected day.
Create your text fields for the days of the week and name them consistently, such as Day1, Day2, Day3, up through Day14 for a two-week schedule.
Add a checkbox next to each day field. Give every checkbox the exact same name, such as "Target Field". However, assign each checkbox an export value that matches its corresponding day number (e.g., export value '1' for Day1, '2' for Day2).
Create your schedule selection buttons (the time ranges). In the button properties, add a 'Run a JavaScript' action triggered by 'Mouse Up'.
Use a script that checks which checkbox is selected and pushes the button's caption to the target field. For example: var targetFieldNumber = this.getField('Target Field').valueAsString; if (targetFieldNumber == 'Off') { app.alert('Select a target field first.'); } else { this.getField('Day' + targetFieldNumber).value = event.target.buttonGetCaption(); }
Instead of pasting the entire script into every button, place the core logic in a document-level JavaScript function. You can then simply call that function from each button's Mouse Up event for easier maintenance.

Create and Manage Interactive PDF Forms with WPS Office
WPS Office provides a comprehensive and user-friendly PDF toolkit that allows you to easily build interactive forms, insert checkboxes, add text fields, and streamline your scheduling tasks seamlessly.
- 1. Open your PDF: Launch WPS Office and open your existing PDF or create a new blank document.
- 2. Access form tools: Navigate to the 'Form' tab on the top ribbon to access the interactive element toolkit.
- 3. Insert fields and checkboxes: Click on 'Text Field' or 'Check Box' and drag across the document to place your form elements for your schedule.
- 4. Save and distribute: Once your schedule layout is complete, save the PDF. It is immediately ready to be shared and filled out by your team.

Frequently Asked Questions
Can I populate multiple PDF fields without using JavaScript?
Basic auto-population can be achieved by giving multiple text fields the exact same name. Whatever is typed into one field will automatically duplicate in the others. However, if you need conditional routing (e.g., selecting a target field first), JavaScript is required.
Why isn't my PDF JavaScript triggering when I click the button?
Ensure you attached the script to the 'Mouse Up' trigger rather than 'Mouse Down' to ensure reliable execution. Additionally, verify that JavaScript execution is not disabled by your PDF reader's security settings.
Will this interactive schedule form work on mobile devices?
Many mobile PDF readers have limited or no support for custom JavaScript actions. For full functionality of scripted buttons, users should open and fill out the form using a desktop PDF application.




