Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

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

New Here ,
Jun 06, 2018 Jun 06, 2018

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;
  
}
}

TOPICS
PDF forms
2.5K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 06, 2018 Jun 06, 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;

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 07, 2018 Jun 07, 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;

   }

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 07, 2018 Jun 07, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 07, 2018 Jun 07, 2018

sorry again I'm a total noob with this, below is the screenshot I have the code in the "Custom Keystroke Script" not the format script. Also I checked off "Commit selected value immediately" under options.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 07, 2018 Jun 07, 2018
LATEST

It needs to be checked ON, not off... And what happens when you change the value of the field? Do you see any error messages appear in the JS Console?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines