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

List specific items in LB2 by the choice of LB1.

New Here ,
Jun 13, 2024 Jun 13, 2024

Copy link to clipboard

Copied

Hi

In Adobe Pro, I want to create a form with two list boxes. The second box should display specific items based on the selections made in the first box, allowing multiple choices to be selected from the first box. 

Also, I want the items that chosen alone be visible. 

TOPICS
PDF forms

Views

56

Translate

Translate

Report

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 ,
Jun 14, 2024 Jun 14, 2024

Copy link to clipboard

Copied

LATEST

Try something like this as 'On Blur' action of "List Box1" field:

var L2 = this.getField("List Box2");
var cList2 = [];
var v = event.target.value;

if (typeof v === "object" && v !== null) {
 for (var i=0; i<v.length; i++) {
  if (v[i] === "Fruits")
   cList2.push("Banana", "Orange", "Apple");       
  if (v[i] === "Vegetables")
   cList2.push("Rice", "Carrot");}}

// If only one item is selected
else if (typeof v === "string") {    
 if (v === "Fruits")
  cList2.push("Banana", "Orange", "Apple");
 else if (v === "Vegetables")
  cList2.push("Rice", "Carrot");}

L2.clearItems();
L2.setItems(cList2);

Votes

Translate

Translate

Report

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