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

Dependent Drop Down Lists

Explorer ,
Sep 03, 2020 Sep 03, 2020

Copy link to clipboard

Copied

Hi, 

 

I have 3 drop down lists with 5 items in each list. Is it possible, if i select in Box 1 for example item 3 and then in Box 2 and 3 is also selected item 3?

I hope you can under stand my question 🙂 

 

TOPICS
PDF forms

Views

905

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

correct answers 1 Correct answer

Explorer , Sep 04, 2020 Sep 04, 2020

2020-09-04 12_19_35-AtZe V4.6 - wip.pdf - Adobe Acrobat Standard 2017.png

 

(function () {

	
    var sItems = getField('PlanerListeLinie').valueAsString;
    var sItems2 = getField('PlanerListeLinieTelefon').valueAsString;
    var sItems3 = getField('PlanerListeLinieMail').valueAsString;
	
    if (!sItems) {
        app.alert("Die Liste ist leer", 3);
        return;  // Don't continue
    }

	
    var aItems = sItems.split(/\r/);
    var aItems2 = sItems2.split(/\r/);
    var aItems3 = sItems3.split(/\r/);

    
    this.getField('TestName').setItems(aItems);
    thi
...

Votes

Translate

Translate
Community Expert ,
Sep 03, 2020 Sep 03, 2020

Copy link to clipboard

Copied

You can do it like this:

Give your selections in each field export values from 1 to 5, and use this code in Dropdown3 field as custom calculation script.

if(this.getField("Dropdown1").value == 3 && this.getField("Dropdown2").value == 3){
event.value = 3;}
else event.value = "";

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
Explorer ,
Sep 03, 2020 Sep 03, 2020

Copy link to clipboard

Copied

Problem is that i populate All three boxes from a Text field and from that they have no Export value. 

I use setItems() to do that. 

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
Enthusiast ,
Sep 03, 2020 Sep 03, 2020

Copy link to clipboard

Copied

You said you are selecting items from box now you said you populate box from text field?

How do you know if it's item 1 or 2 or 3? How do you populate them?

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
Explorer ,
Sep 03, 2020 Sep 03, 2020

Copy link to clipboard

Copied

Ok, from beginning. At first a User can write down the entries in 3 Text fields, Name, number and Email. 

 Then He cann fill up the boxes with their lists. 

 

After that i want that He can select Name 1 in Box 1 and Box 2&3 are select the correspending number and Mail... 

 

You know what i mean? 

So people from other teams can fill up the boxes with their own employees without to go to the Code in the fields

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
Community Expert ,
Sep 03, 2020 Sep 03, 2020

Copy link to clipboard

Copied

Should the other drop-downs be editable by the user? If not, just convert them to (read-only) text fields and use the code provided above as their calculation script.

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
Explorer ,
Sep 04, 2020 Sep 04, 2020

Copy link to clipboard

Copied

i use the following code:

 

(function () {

	var sItems = getField("PlanerListeLinie").valueAsString;
    if (!sItems) {
        app.alert("Die Liste ist leer", 3);
        return;  // Don't continue
    }	
    var aItems = sItems.split(/\r/);  
    this.getField("Linienplaner").setItems(aItems);
   app.alert("Planer Linie wurden in die Liste übernommen", 3);

})();

setItems(aItems, bItems)

will not work for export value...

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
Community Expert ,
Sep 04, 2020 Sep 04, 2020

Copy link to clipboard

Copied

To set export values you must use an array of arrays of strings, like this:

this.getField("Dropdown1").setItems([ ["Item 1", "Export Value 1"], ["Item 2", "Export Value 2"] ]);

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
Explorer ,
Sep 04, 2020 Sep 04, 2020

Copy link to clipboard

Copied

2020-09-04 12_19_35-AtZe V4.6 - wip.pdf - Adobe Acrobat Standard 2017.png

 

(function () {

	
    var sItems = getField('PlanerListeLinie').valueAsString;
    var sItems2 = getField('PlanerListeLinieTelefon').valueAsString;
    var sItems3 = getField('PlanerListeLinieMail').valueAsString;
	
    if (!sItems) {
        app.alert("Die Liste ist leer", 3);
        return;  // Don't continue
    }

	
    var aItems = sItems.split(/\r/);
    var aItems2 = sItems2.split(/\r/);
    var aItems3 = sItems3.split(/\r/);

    
    this.getField('TestName').setItems(aItems);
    this.getField('TestTelefon').setItems(aItems2);
    this.getField('TestMail').setItems(aItems3);
	
    app.alert("Planer Linie wurden in die Liste übernommen", 3);

})();

 

I dont need any export Values and found an other solution.

 

Code for TestTelefon

var start = this.getField('TestName').currentValueIndices;
var ziel = this.getField('TestTelefon');

ziel.currentValueIndices = start; 

same for TestMail and now if i select an item in the List TestName, the other ones changes to the same index...

 

this work flawlesly

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
Explorer ,
Sep 07, 2020 Sep 07, 2020

Copy link to clipboard

Copied

LATEST

New Code, but it doesnt work...i cant see the mistake...

 

(function () {

    var sItems = getField('PlanerListeLinie').valueAsString;
    var sItems2 = getField('PlanerListeLinieTelefon').valueAsString;
    var sItems3 = getField('PlanerListeLinieMail').valueAsString;
	
    if (!sItems) {
        app.alert("Die Liste ist leer", 3);
        return;  // Don't continue
    }

    var aItems = sItems.split(/\r/);
    var aItems2 = sItems2.split(/\r/);
    var aItems3 = sItems3.split(/\r/);


this.getField('TestName').clearItems();
this.getField('TestTelefon').clearItems();
this.getField('TestMail').clearItems();
for (var i = 0; i < aItems.length; i+=1) {
    var b = aItems[i];
    this.getField('TestName').insertItemAt(b, i, 0);
    }
// for (var i = 0; i < aItems2.length; i++) {
//     this.getField('TestTelefon').insertItemAt(aItems2, i, 0);
//     }






    // this.getField('TestName').setItems(aItems, aItemsA);
    // this.getField('TestTelefon').setItems(aItems2);
    //this.getField('TestMail').setItems(aItems3);
	
    app.alert("Planer Linie wurden in die Liste übernommen", 3);

})();

 

i hope that this will work to fill the combobox, but adobe doesnt accept this, invalid argument is printed in console at function insertItemAt...any ideas?

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