Skip to main content
cristianl57447885
Participant
June 6, 2018
Question

How to create drop down list to trigger checkboxs to select from using Adobe Pro

  • June 6, 2018
  • 1 reply
  • 2524 views

Dropdown List to trigger checkboxs to appear

Hello all,

Total noob here

Thank you in advance for any help you can provide!

I have a dropdown field labled "Departments"

Within the dropdown list I have the options:

• HR

• Legal

• Accounting

If user selects HR, Legal, or Accounting, I need to have a few checkboxs to auto apper base on the selected department .

If user selects HR, I need 3 checkboxs to appear so the user can select one, two or all three

If users selects Legal I need 5 checkboxs to appear so the can select all of just a few.

Can someone provide me with some steps by step of what I need to do you get to where I need to enter the script codes and what it should look like. I found this on another site but have no idea where to put it

if(event.willCommit)
{
  
switch(event.value)
  
{
  
case "Checking":
  
this.getField("somecheckbox").value = "Yes";
  
break;
  
case "Savings":
  
<.. do something .. >
  
break;
  
case "CD":
  
<.. do something .. >
  
break;
  
case "IRA":
  
<.. do something .. >
  
break;
  
case "Safe Deposit":
  
<.. do something .. >
  
break;
  
}
}

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
June 6, 2018

The code you have is good. It should be used as the field's custom Keystroke script.

To make a field hidden use this basic code:

this.getField("FieldName").display = display.hidden;

And to make it visible:

this.getField("FieldName").display = display.visible;

cristianl57447885
Participant
June 7, 2018

hi Try67,

     Ok I finally found where to put this code using Adobe XI Pro which is in the Dropdown Properties -> Format tab -> select format category to "CUSTOM" and then click on "Edit" for "Custom keystroke script:"

I entered the following code to test but after selecting HR or Finance in the dropdown menu nothing appears.

Are there more codes I have to enter to get the check boxes to appear or do I have to create them manually and somehow link them?

if(event.willCommit)

{

   switch(event.value)

   {

   case "HR":

   this.getField("somecheckbox1").value = "Yes";

   break;

   case "HR":

   this.getField("somecheckbox2").value = "Yes";

   break;

   case "HR":

   this.getField("somecheckbox3").value = "Yes";

   break;

   case "Finance":

   this.getField("somecheckbox1").value = "Yes";

   break;

   case "Finance":

   this.getField("somecheckbox2").value = "Yes";

   break;

   case "Finance":

   this.getField("somecheckbox2").value = "Yes";

   break;

   }

}

try67
Community Expert
Community Expert
June 7, 2018

You placed it in the wrong location. This code should be used as the custom KEYSTROKE script, not the FORMAT script...

Personally, I prefer to use the Validation event, instead of the Keystroke event. You can use the same code (except for the willCommit part) and move it to the field's custom validation script, and it should work the same. Make sure to tick the option to commit the selected value immediately, though, so that it will take effect the moment you make a selection. Otherwise it will only run when you exit the field.

You'll find this option under the field's Properties, Options tab.