Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
5

Problems with Auto fill text from Dropdown menu

New Here ,
Mar 25, 2024 Mar 25, 2024

I am trying to create a form With Acrobat pro where when I use the dropdown to select a courthouse, and it populates three text boxes in the form. I have gotten it to work partially.  But only for some of the selected options. I have checked everything and it all looks the same so I am not sure what the issue is.  I have tried going in and fixing the options that are not working but am having no success. of the 8 options I have in the drop down menu, only 4 work. 

The ones that do not work are, West Covina, Santa Monica,  Long Beach, and Compton. 

 

Here is the script I am running:

 

var dropdownValue = this.getField("Dropdown1").value;

switch (dropdownValue){
case "Stanley Mosk":
this.getField("CourtST").value = "111 North Hill Street"
this.getField("CourtCZ").value = "Los Angeles, 90012"
this.getField("CourtBR").value = "Central District"
break;

 

case "West Covina":
this.getField("CourtST").value = "1427 W Covina Pkwy"
this.getField("CourtCZ").value = "West Covina, 91790"
this.getField("CourtBR").value = "East District"
break;


case "Pasadena":
this.getField("CourtST").value = "300 E Walnut St"
this.getField("CourtCZ").value = "Pasadena,91101"
this.getField("CourtBR").value = "Northeast District"
break;

 

case "Compton":
this.getField("CourtST").value = "200 West Compton Blvd."
this.getField("CourtCZ").value = "Compton, 90220"
this.getField("CourtBR").value = "South Central District"
break;

 

case "Inglewood":
this.getField("CourtST").value = "1 Regent Street"
this.getField("CourtCZ").value = "Inglewood, 90301"
this.getField("CourtBR").value = "Southwest District"
break;

 

case "Santa Monica":
this.getField("CourtST").value = "1725 Main Street"
this.getField("CourtCZ").value = "Santa Monica, 90401"
this.getField("CourtBR").value = "West District"
break;

 

case "Norwalk":
this.getField("CourtST").value = "12720 Norwalk Blvd"
this.getField("CourtCZ").value = "Norwalk, 90650"
this.getField("CourtBR").value = "Southeast District"
break;

 

case "Longbeach":
this.getField("CourtST").value = "275 Magnolia Ave "
this.getField("CourtCZ").value = "Long Beach, 90802"
this.getField("CourtBR").value = "South District"
break;

case "-Select-":
this.getField("CourtST").value = ""
this.getField("CourtCZ").value = ""
this.getField("CourtBR").value = ""
break;

}

 

TOPICS
General troubleshooting , How to , JavaScript
447
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 25, 2024 Mar 25, 2024

Make sure those choices are correctly spelled in the dropdown field.

Where do you use script?

If you use it in dropdown field replace,

this:

var dropdownValue = this.getField("Dropdown1").value;

switch (dropdownValue){

 

with this:

switch (event.value){

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 26, 2024 Mar 26, 2024
LATEST

Also, make sure the "Commit selected value immediately" option is selected.

This article may provide some help:

https://acrobatusers.com/tutorials/change_another_field/

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines