Highlighted

Using an array to autofill multiple dropdowns which each push data to a series of text fields

New Here ,
Oct 05, 2020

Copy link to clipboard

Copied

In short, I have information that lead me to this:

\\Document JS Array

var itemList = new Array ();

    itemList[0] =  ["None"," ", " ", " ", " ", " "],

    itemList[1] =  ["Item1", "0", "10", "20", "30", "40"],

    itemList[2] =  ["Item2", "1", "11", "21", "31", "41"],

    itemList[3] =  ["Item3", "2", "12", "22", "32", "42"],

    itemList[4] =  ["Item4", "4", "14", "24", "34", "44"]

};

\\in Custum Calculation Script within each text field: 

\\(where .# is the row number, 0 based.

var sele = this.getField("itemList.#").value ;

this.getField("statOne.#").value = itemList[sele][1] ;

 

\\Field names are:

itemList.#(dropdown), statOne.#, statTwo.#, statThree.#, statFour.#, and statFive.#

 

And, this works.  However, since it is running calculations, once there are a bunch of dropdowns on a sheet, the PDF starts to get boggy.  Using the calculations seems clunky and inelegant to me, since each and every text field has to be written individually.

 

Now then, my question is thus: is there not a better, cleaner, more elegant way to make this work.  I have tried to recreate some keystroke scripts, but, honestly, don't know quite enough to manipulate the two dimensional array into it.

TOPICS
PDF forms

Views

31

Likes

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

Using an array to autofill multiple dropdowns which each push data to a series of text fields

New Here ,
Oct 05, 2020

Copy link to clipboard

Copied

In short, I have information that lead me to this:

\\Document JS Array

var itemList = new Array ();

    itemList[0] =  ["None"," ", " ", " ", " ", " "],

    itemList[1] =  ["Item1", "0", "10", "20", "30", "40"],

    itemList[2] =  ["Item2", "1", "11", "21", "31", "41"],

    itemList[3] =  ["Item3", "2", "12", "22", "32", "42"],

    itemList[4] =  ["Item4", "4", "14", "24", "34", "44"]

};

\\in Custum Calculation Script within each text field: 

\\(where .# is the row number, 0 based.

var sele = this.getField("itemList.#").value ;

this.getField("statOne.#").value = itemList[sele][1] ;

 

\\Field names are:

itemList.#(dropdown), statOne.#, statTwo.#, statThree.#, statFour.#, and statFive.#

 

And, this works.  However, since it is running calculations, once there are a bunch of dropdowns on a sheet, the PDF starts to get boggy.  Using the calculations seems clunky and inelegant to me, since each and every text field has to be written individually.

 

Now then, my question is thus: is there not a better, cleaner, more elegant way to make this work.  I have tried to recreate some keystroke scripts, but, honestly, don't know quite enough to manipulate the two dimensional array into it.

TOPICS
PDF forms

Views

32

Likes

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
Oct 05, 2020 0
Adobe Community Professional ,
Oct 05, 2020

Copy link to clipboard

Copied

Set the values of the text fields at validation of the dropdown lists.

Likes

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
Reply
Loading...
Oct 05, 2020 1