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

Create a drop down from a result

New Here ,
Mar 27, 2017 Mar 27, 2017

I am trying to create a multiple option dropdown from a result in a previous box.  for example.  if you select "740" then you have can 1/2,3/4, or 1.0  if you select "560" then you can have 1.25, 1.5, or 2.0

var v1 = this.getField("Series").value;

if (v1 == 740) {

    event.value = "1/2,3/4,1.0";}

only the 1/2 shows up and i need all three to be an option to select.

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

Community Expert , Mar 29, 2017 Mar 29, 2017

You need to use the Validation event. The Calculation event is triggered whenever the value of any field is changed.

So you would just keep re-applying the values to the fields if you do it like that...

Translate
Community Expert ,
Mar 28, 2017 Mar 28, 2017

For dropdown lists you must use setItems.

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 ,
Mar 28, 2017 Mar 28, 2017

I used this statement and it creates a dropdown but it does not allow me to select anything other than my first option of "1/2-D"  if i try to select something else it reverts back to "1/2-D"

switch (event.value) { 

case "740": 

this.getField("Inlet").setItems(["1/2-D","3/4-D","1.0-D","1/2-E","3/4-E","1.0-E","1.25-E","1.0-F","1.25-F","1.5-F","1.25-G","1.5-G","2.0-G","2.0-J","2.5-J","3.0-J"]); 

break;}

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 ,
Mar 28, 2017 Mar 28, 2017

Where did you place this code, and what's the full code?

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 ,
Mar 28, 2017 Mar 28, 2017

I  have a drop down box named "Series" with 4 options 740, 741, 742,743.  in this drop down i wrote this code:

switch (event.value) {

case "740":

this.getField("Inlet").setItems(["1/2-D","3/4-D","1.0-D","1/2-E","3/4-E","1.0-E","1.25-E", "1.0-F","1.25-F","1.5-F","1.25-G","1.5-G","2.0-G","2.0-J","2.5-J","3.0-J"]);

break;}

I then have another dropdown box named "Inlet" where the results show up.  From there i want to select one of those options and then create another dropdown named "Outlet" 

In the "Inlet" dropdown i wrote this:

switch (event.value) {

case "1/2-D":

this.getField("Outlet").setItems(["1/2-D","3/4-D","1.0-D"]);

break;}

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 ,
Mar 29, 2017 Mar 29, 2017

lambo99  wrote

I  have a drop down box named "Series" with 4 options 740, 741, 742,743.  in this drop down i wrote this code:

...

Where did you wrote the code?

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 ,
Mar 29, 2017 Mar 29, 2017

in the calculate section of the drowpdown box named "Series"

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 ,
Mar 29, 2017 Mar 29, 2017

You need to use the Validation event. The Calculation event is triggered whenever the value of any field is changed.

So you would just keep re-applying the values to the fields if you do it like that...

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 ,
Mar 29, 2017 Mar 29, 2017
LATEST

That worked perfect.  Thank you very much

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