Skip to main content
JJB96
Participant
October 8, 2018
Question

Linking Checkboxes and Radio Buttons

  • October 8, 2018
  • 1 reply
  • 291 views

Hello guys i need your help,

i have 5 Checkboxes. Everyone of them can be checked or unchecked by itself. If the 5th Checkbox is checked, a RadioButton with 2 options should be activated. If the 5th Checkbox gets unchecked the linked Radiobutton should be unchecked and deactivated, so that both options are blank.

So my first question is what to write in js and my second question is where to write it or which trigger i need to choose.

I've tried it now for houres and didnt come to a close, i hope u can help me.

Below u can find what i already tried. "Chechbox5" is obviously the name of the fifth Checkbox and "RB_1" the name of the Radio Button. My Acrobat DC Version is 2015.006.30452.

Thanks

First Try

var source = null;

source = this.getField("CheckBox5")

if (source.isBoxChecked() == false)

{

    this.getField("RB_1").value = false;

}

Second Try

if (this.getField("Checkbox5").value == false)

{

    this.getField("RB_1").value = false;

}

Third Try

if (this.getField("Checkbox5").value == false)

{

    this.getField("RB_1").value = "Off";

}

Fourth Try

if (this.getField("Checkbox5").value == false)

{

    this.resetForm("RB_1");

}

This topic has been closed for replies.

1 reply

Inspiring
October 8, 2018

You didn't say where you placed those scripts, but I'll suggest the following as the Mouse Up script of the check box:

// Get a reference to the radio button group

var f = getField("RB_1");

// If this check box is selected...

if (event.target.value !== "Off") {

    f.value = "Off";  // ...deselect radio buttons

}

It wasn't clear whether you wanted to also make the radio button read-only and/or hidden when the check box is selected, but that's possible too.