Skip to main content
Participant
June 9, 2024
Answered

Acrobat Form: Populate a Text field based on the values selected from 3 other dropdowns

  • June 9, 2024
  • 1 reply
  • 570 views

Good day All,

 

Please could someone kindly assist me with this query? I would like to populate a text field "Risk Rating" with a value based on the combination of 3x other Dropdowns.

Dropdown 1: "Risk Area" = Area 1, Area 2, Area 3

Dropdown 2: "Likelihood" = Unlikely, Possible, Almost Certain

Dropdown 3: "Consequence" = Minor, Moderate, Major

 

I have a matrix with the various combinations but would like to display the different value based on the combination of the above 3 dropdown values.

 

Example Output 1: "Area 1" + "Possible" + "Moderate" then Risk Rating text field must show "18 (High)"

Example Output 1: "Area 2" + "Unlikely" + "Minor" then Risk Rating text field must show "6 (Low)"

Example Output 1: "Area 1" + "Almost Certain" + "Major" then Risk Rating text field must show "24 (Very High)"

 

Your help & assistance will be greatly appreciated. I know this can be easily done - I just do not know scripting.

 

Regards

Neil

This topic has been closed for replies.
Correct answer try67

Single & is also possible in this case.


But then you have to make sure to only use boolean expressions, because 1& 10 will return 0 (which will be converted to false), while 1 && 10 will return 10 (which will be converted to true), since the single-ampersand operator works at the bit level.

1 reply

Neil5E0FAuthor
Participant
June 9, 2024

I tried this & it works!!

Not sure if there is a better way?

 

var Risk = this.getField("Risk_Area").value;
var Like = this.getField("Likelihood").value;
var Cons = this.getField("Consequence").value;

if (Risk=="Area 1" & Like=="Possible" & Cons=="Moderate") event.value = "18-High";
else if (Risk=="Area 2" & Like=="Unlikely" & Cons=="Minor") event.value = "6-Low";
else if (Risk=="Area 1" & Like=="Almost Certain" & Cons=="Major") event.value = "24-Very High";
else event.value = "";

Nesa Nurani
Community Expert
Community Expert
June 9, 2024

You need to use double && not single &

Bernd Alheit
Community Expert
Community Expert
June 9, 2024

Single & is also possible in this case.