Skip to main content
Participant
March 19, 2025
Question

JavaScript in PDF Fillable Form to auto-populate a field based on ONE choice from radio button list

  • March 19, 2025
  • 2 replies
  • 381 views

I am new to JavaScript. However, I've worked with fillable pdf forms. Can someone provide JavaScript code that will perform the following function within the form:

The form user will make one choice from Classification Area (5 selections: Student Development; Interagency Collaboration; Student-Focused Planning; Program Structure; Family Involvement). Based on the selection from these areas, a Heading field will be auto-populated on page 2 of the form. 

Also, I need to allow for multiple line entries in several fields in various fields of this form that might mean that the information will need to extend and add pages as the user types in requested information. 

2 replies

Participant
March 31, 2025

I'm checking back in. I've worked with what was provided on March 19th. I've still not able to see the function that I need. I'm asking for a bit more instruction as to where this script should be entered (the auto-pop field or radio buttons). Thank you.

PDF Automation Station
Community Expert
Community Expert
March 31, 2025

"enter the following calculation script in the heading text field"

PDF Automation Station
Community Expert
Community Expert
March 19, 2025

Set the export values ("choices" for radio buttons) to the heading text (Student Development, Interagency Collaboration, Student-Focused Planning, Program Structure, Family Involvement) and enter the following calculation script in the heading text field:

this.getField("Radio1").value=="Off"?event.value="":event.value=this.getField("Radio1").value;

Change the name of Radio1 to the actual radio button group field name.

You can't expand pages as the user types with an Acro Form (PDF form created with Adobe Acrobat).