Skip to main content
davidp60953449
Known Participant
September 28, 2017
Answered

Display text field based on selection in two different dropdown lists

  • September 28, 2017
  • 1 reply
  • 2859 views

In Acrobat, given two dropdown lists, one with 13 items and the other with 3, the user makes a single selection in each list. The result is to display a text field based on the unique combination of these two dropdown choices. My js skills are quite limited, but I assume there is a way to do that. Any help appreciated.

This topic has been closed for replies.
Correct answer try67

Sure. You can use something like this as the custom calculation script of the text field:

var v1 = this.getField("Dropdown1").valueAsString;

var v2 = this.getField("Dropdown2").valueAsString;

if (v1=="Tom" && v2=="Smith") event.value = "Manager";

if (v1=="Tom" && v2=="Roberts") event.value = "Vice-President";

if (v1=="Jane" && v2=="Becker") event.value = "CEO";

if (v1=="Rodney" && v2=="Dangerfield") event.value = "Janitor";

// etc.

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
September 28, 2017

Sure. You can use something like this as the custom calculation script of the text field:

var v1 = this.getField("Dropdown1").valueAsString;

var v2 = this.getField("Dropdown2").valueAsString;

if (v1=="Tom" && v2=="Smith") event.value = "Manager";

if (v1=="Tom" && v2=="Roberts") event.value = "Vice-President";

if (v1=="Jane" && v2=="Becker") event.value = "CEO";

if (v1=="Rodney" && v2=="Dangerfield") event.value = "Janitor";

// etc.

davidp60953449
Known Participant
September 28, 2017

Thanks for the swift reply try67. I basically get what you're saying there except for the event.value naming. Is that just a text field set to hidden?

try67
Community Expert
Community Expert
September 28, 2017

That's just how you assign the value to the field that's being calculated.