Skip to main content
Participant
August 11, 2024
Answered

Need script to show text if multiple dropdown selections match

  • August 11, 2024
  • 1 reply
  • 409 views

Using Adobe Acrobat Pro - I am creating a form that has 6 different sections.  I have a dropdown field with the option to choose either PASS or FAIL in each section.  I looking for way to show a hidden text field only if the option PASS is selected in all 6 dropdown fields.  Is this possible?  Need help with javascript if so.  Thanks!

 

 

This topic has been closed for replies.
Correct answer Nesa Nurani

Let's say your dropdown fields are named "Dropdown1" to "Dropdown6", as custom calculation script of text field you wish to show/hide use this:

var count = 0;
for(var i=1; i<=6; i++){
var f = this.getField("Dropdown"+i).valueAsString;
if(f === "PASS")count++;}

event.target.display = (count == 6) ? display.visible : display.hidden;

1 reply

Nesa Nurani
Community Expert
Nesa NuraniCommunity ExpertCorrect answer
Community Expert
August 11, 2024

Let's say your dropdown fields are named "Dropdown1" to "Dropdown6", as custom calculation script of text field you wish to show/hide use this:

var count = 0;
for(var i=1; i<=6; i++){
var f = this.getField("Dropdown"+i).valueAsString;
if(f === "PASS")count++;}

event.target.display = (count == 6) ? display.visible : display.hidden;
Participant
August 11, 2024

That worked perfectly!  Thank you so much for your help!  I have been reading through threads all day trying to find something that would work, with no luck.  I've seen your helpful replies on so many of these and was secretly hoping you would reply to mine lol!  Again, thank you so so so much for the help!  Truly appreciate it!