Copy link to clipboard
Copied
Greetings. I have looked all over for this solution and am hitting a wall.
I have two dropdown lists on my Adobe Acrobat DC form. Here is the pseudocode I am trying to create into a javascript action:
If (dropdownList1 value == "department1") && (dropdownList2 value == "building1") then textBox value == "Mr. Church"
else
textBox value == " "
Anyone had any luck getting something like this working?
Thanks.
[Moderator moved from non-technical forum Lounge to JavaScript .]
Nancy
You almost have the correct script - you just need to convert it to valid JavaScript syntax and to use the correct Acrobat API functions:
var d1 = this.getField("dropdownList1").value;
var d2 = this.getField("dropdownList2").value;
if ((d1 == "department1") && (d2 == "building1"))
{
event.value = "Mr. Church";
}
else
{
event.value = "";
}
When you use this as the custom calculation script in your text field, you should see the behavior you described.
Copy link to clipboard
Copied
You almost have the correct script - you just need to convert it to valid JavaScript syntax and to use the correct Acrobat API functions:
var d1 = this.getField("dropdownList1").value;
var d2 = this.getField("dropdownList2").value;
if ((d1 == "department1") && (d2 == "building1"))
{
event.value = "Mr. Church";
}
else
{
event.value = "";
}
When you use this as the custom calculation script in your text field, you should see the behavior you described.
Copy link to clipboard
Copied
BTW: If you want to learn how JavaScript works, take a look here: Learning to Program JavaScript for Adobe Acrobat - KHKonsulting LLC
Copy link to clipboard
Copied
OMG you are a lifesaver!!! This is EXACTLY what I was looking for.
Thank you! I am new to the forum, so is there any way to assign you points for this?
Copy link to clipboard
Copied
How would you add more conditions to that for more combinations of choices?