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

Dynamic Dropdown Reverts to Default Value, Does Not Hold Selected Value

New Here ,
Feb 01, 2016 Feb 01, 2016

I am trying to create a form in Adobe Acrobat XI Pro with three drop downs, two of which are dependent upon the selection made in the drop down before it.

Given that I've never done anything of this nature previously, I have followed the advice given in this thread but am having an issue that didn't seem to come up there, and I couldn't find anything similar in other threads.

The population of the dynamic drop down menus works fine, but I'm having trouble getting the values selected in the second and third drop downs to "stick".

Initially, I did not set the field to "Commit selected value immediately", which allowed my selection to be made and held until I clicked out of the second drop down, then it reverted to the initial/top value in the list but the options in the third drop down were still related to the selection made but as soon as any selection is made, it also reverts based on the second drop down's reverted value.  If I select "Commit selected value immediately in the options, my selection is instantly reverted without having to click out of the field.

Any help would be greatly appreciated!

Here is the code I've entered in the "Custom calculation script" boxes for the first two drop downs:

//Drop1 - Initial selection sets options in second drop down

switch(event.value){

   case "A":

      this.getField("Drop2").setItems(["A1","A2","A3"]);

      break;

   case "B":

      this.getField("Drop2").setItems(["B1","B2","B3"]);

      break;

   case "C":

      this.getField("Drop2").setItems(["C1","C2","C3"]);

      break;

}

//Drop2 - Secondary selection sets options for third drop down

switch(event.value){

   case "A1":

      this.getField("Drop3").setItems(["A1a","A1b","A1c"]);

      break;

   case "A2":

      this.getField("Drop3").setItems(["A2a","A2b","A2c"]);

      break;

   case "A3":

      this.getField("Drop3").setItems(["A3a","A3b","A3c"]);

      break;

   case "B1":

      this.getField("Drop3").setItems(["B1a","B1b","B1c"]);

      break;

   case "B2":

      this.getField("Drop3").setItems(["B2a","B2b","B2c"]);

      break;

   case "B3":

      this.getField("Drop3").setItems(["B3a","B3b","B3c"]);

      break;

   case "C1":

      this.getField("Drop3").setItems(["C1a","C1b","C1c"]);

      break;

   case "C2":

      this.getField("Drop3").setItems(["C2a","C2b","C2c"]);

      break;

   case "C3":

      this.getField("Drop3").setItems(["C3a","C3b","C3c"]);

      break;

}

TOPICS
Acrobat SDK and JavaScript , Windows
1.7K
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

correct answers 1 Correct answer

LEGEND , Feb 01, 2016 Feb 01, 2016

You shouldn't be placing these as calculation scripts. They can be custom validation scripts and with modification, custom Keystroke scripts. The first one should be a custom validate script for the first dropdown.

Translate
LEGEND ,
Feb 01, 2016 Feb 01, 2016

You shouldn't be placing these as calculation scripts. They can be custom validation scripts and with modification, custom Keystroke scripts. The first one should be a custom validate script for the first dropdown.

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
New Here ,
Feb 01, 2016 Feb 01, 2016

You're my hero today, George!  Thank you!  I copied the code into the custom validation script instead and it works perfectly!

Thank you again!

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
New Here ,
Aug 17, 2018 Aug 17, 2018

I'm having a related issue. I have a block to type in, which I want to affect a dropdown. There are 4 options in the block as well as a default. However, what is happening is that there seems to be a lag. When I put in case 1 it doesn't do anything. And then, I'll type in case 2, and the dropdown will be for case 1, and if I switch back to case 1, it will update with the dropdown for case 2. It always seems to be one behind and I can't figure out why.

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 ,
Aug 17, 2018 Aug 17, 2018
LATEST

Make sure you enable the option to commit the selected value of the drop-down immediately (under its Properties, Options tab).

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