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

Have a calculated dropdown box default to top option when clicking away from dropdown

New Here ,
Sep 23, 2020 Sep 23, 2020

Copy link to clipboard

Copied

I am having issues with a calculated dropdown box. The dropdown box (D2) is being calculated based off of the value of another dropdown (D1) on my form. For example, if D1 = "View Only" then the options in D2 should be "Does Not Need View Only" or "Needs View Only". I have been able to accomplish this via a calculated javascript (below for reference).

 

However; my issue is when I make my selection in D2 and I click away from the dropdown box it automatically defaults to the top of the list (i.e. If I select "Needs View Only" in the drop down and click away it will jump back up to "Does Not Need View Only"). I am pretty sure it is an issue with one of the properties of the dropdown but cannot figure out which one. I have played around with the Sort items and Commit after selected flag on the options tab of the properties with no help. If needed I can send screenshots of my current configuration of the dropdown properties. Any help would be greatly appreciated!!

 

Javascript : 

if (event.value=="View Only") this.getField("D2").setItems(["Does Not Need View Only", "Needs View Only"]);

TOPICS
Acrobat SDK and JavaScript

Views

624

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

Community Expert , Sep 23, 2020 Sep 23, 2020

Move it to the Validation event. That way it will only execute when you make a selection in that field, not in any field.

Votes

Translate

Translate
Community Expert ,
Sep 23, 2020 Sep 23, 2020

Copy link to clipboard

Copied

Where does you use the 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
New Here ,
Sep 23, 2020 Sep 23, 2020

Copy link to clipboard

Copied

The script is located in the Calculate tab of D1 dropdown box. It is in the Custom calculation script box.

 

 

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 23, 2020 Sep 23, 2020

Copy link to clipboard

Copied

Move it to the Validation event. That way it will only execute when you make a selection in that field, not in any field.

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
New Here ,
Sep 23, 2020 Sep 23, 2020

Copy link to clipboard

Copied

That did it!! Thank you so much for your help try67, I actually stole my javascript code from an earlier post of yours so you have helped me twice on this issue!! 🙂

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 23, 2020 Sep 23, 2020

Copy link to clipboard

Copied

The calculation scripts overrides your selection. You can't have it both ways.

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
New Here ,
Sep 23, 2020 Sep 23, 2020

Copy link to clipboard

Copied

Are there any other ideas for how I could perform what I am trying to get done. Essentially what I am doing is trying to implement some sort of dynamic filtering. In reality D1 has several options to choose from in addition to View Only and I want D2 to be filtered based on D1's selection so I am not delivering a huge list of options to the users. 

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 23, 2020 Sep 23, 2020

Copy link to clipboard

Copied

LATEST

It is posssible, if set up correctly. See my reply above about where to place the code.

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