Skip to main content
Known Participant
Sep 5, 2023 8:34 PM UTC
Answered

Multi Level Dependable Dropdown and Text Field

Hi! Experts, 

I am creating a PDF Fillable Form. I created a Dependable Dropdown it's working using the below code 

First Dropdown Name: "Tile"

Second Dropdown Name: "Condition"

 

This code is pasted in First Dropdown "Tile"

 

var f = this.getField("Condition");
switch(event.value){

case "Terracotta":
f.setItems(["lichen"]);
break;

case "Concrete Tiles":
f.setItems(["Acceptable","Fair","Poor","Mould","Moss" ]);
break;

case"-Select-":
f.clearItems();}

 

its create dropdown items in 2nd dropdown. 

 

NOW I want to auto-populate the Description based on 2nd dropdown selected in 

Third Field Name: "Description"

 

For Exemple:

in 2nd dropdown "Acceptable" Selected it auto populate description in "Description" field and so on. 

Kindly Help me out. 

This topic is closed to new replies. Start a new post to keep the conversation going.
try67
try67Correct answer
Community Expert
Sep 5, 2023 9:25 PM UTC

You can use something like this:

 

var tile = this.getField("Tile").valueAsString;
var condition = this.getField("Condition").valueAsString;
if (tile=="Concrete Tiles" && condition=="Acceptable") event.value = "The concrete tiles are in acceptable condition.";
else if (tile=="Concrete Tiles" && condition=="Fair") event.value = "The concrete tiles are in fair condition. Further inspection is required.";
// etc.

3 replies

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
Sep 5, 2023 9:25 PM UTC

You can use something like this:

 

var tile = this.getField("Tile").valueAsString;
var condition = this.getField("Condition").valueAsString;
if (tile=="Concrete Tiles" && condition=="Acceptable") event.value = "The concrete tiles are in acceptable condition.";
else if (tile=="Concrete Tiles" && condition=="Fair") event.value = "The concrete tiles are in fair condition. Further inspection is required.";
// etc.
Translate
Hafiz79Author
Known Participant
Sep 5, 2023 8:39 PM UTC

Image for reference

 

Translate
Thom Parker
Community Expert
Community Expert
Sep 5, 2023 9:06 PM UTC
Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often