Copy link to clipboard
Copied
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;
}
}
Copy link to clipboard
Copied
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;
Copy link to clipboard
Copied
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;
}
}
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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?
Find more inspiration, events, and resources on the new Adobe Community
Explore Now