Skip to main content
Inspiring
December 31, 2021
Answered

If/Then Statement with Dropdown List

  • December 31, 2021
  • 1 reply
  • 3302 views

Hello,

 

I am using Adobe Pro DC and attempting to create a form with IF/THEN statements and dropdown lists. I have looked at all of the similar questions in the community, but was unable to find exactly what I needed. 

 

Here's what is needed:

 

Dropdown 1 will list men, women, or children. 

Drowdown 2 will list shirt sizes based on the selection in dropdown 1. 

 

So IF children is selected in Dropdown 1, how do I make sure that ONLY certain options are available in Dropdown 2?

 

Thank you!

This topic has been closed for replies.
Correct answer AEJ1215

Sorry, I forgot to mention that I input this into Dropdown 1 under Custom Keystroke Script.

1 reply

Thom Parker
Community Expert
Community Expert
December 31, 2021

So you want to load a list (i.e. dropdown) based on the selection from another list?

This has be asked many times. Here are some articles, with examples, that cover this issue.

 

https://acrobatusers.com/tutorials/js_list_combo_livecycle/

https://acrobatusers.com/tutorials/change_another_field/

https://www.pdfscripting.com/public/List-Field-Usage-and-Handling.cfm

 

  

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
AEJ1215Author
Inspiring
December 31, 2021

Hi! I actually found a youtube video tutorial that had exactly what I was looking for. Here's my code and it works. 

 

var genderlist = this.getField("Gender");

if(event.willCommit)
{
switch (event.value){

case "Man":
genderlist.setItems(["-Select Size", "Small", "Medium", "Large", "XL", "2XL"]);
break;

case "Woman":
genderlist.setItems(["-Select Size", "Small", "Medium", "Large", "XL", "2XL"]);
break;

case "Child":
genderlist.setItems(["-Select Size", "2T", "3T", "4T", "5T", "X-Small"]);
break;

}

}

AEJ1215AuthorCorrect answer
Inspiring
December 31, 2021

Sorry, I forgot to mention that I input this into Dropdown 1 under Custom Keystroke Script.