Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 334
  • Last Modified:

In Acrobat: How do I make a group of radio buttons only appear when a certain checkbox is checked?

Hi fellas,

I've got an Adobe form I'm working on.  It is intended to document changes to system access (permission changes in AD, access to various financial applications, etc.).  It presents a list of systems available, and next to each one are three radio buttons named Add, Change, or Remove.  I want these radio buttons to be grayed out or invisible or otherwise inaccessible unless a checkbox next to the system name is checked.  

So in short:  When checkbox is checked, radio buttons can be selected.  When unchecked, they are inaccessible.

I figure this will involve some VBScript or JavaScript, but I have no idea (1)what the code will be and (2)how to inject the code into the PDF.
0
imtt321
Asked:
imtt321
1 Solution
 
Karl Heinz KremerCommented:
There is no VBScript in Acrobat, all customization is done via JavaScript. Let's assume you have a radio button group named "Group.1" with the three options Add, Change and Remove, and a checkbox named "CheckBox.1" . Open up the field properties for your checkbox and go to the "Action" tab, then add a "Mouse Up" action of "Run a JavaScript" and use the following script:

var res = event.target.name.split('.');
var idx = 0;
if (res.length > 1) {
    idx = res[1];
}

if (event.target.value == "Off") {
    this.getField("Group." + idx).readonly = true;
}
else {
    this.getField("Group." + idx).readonly = false;
}

Open in new window


You can use the same script for each of your checkbox/group combinations, as long as they all share the same numeric extension (e.g. .1 .2 and .3).
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now