Skip to main content
Known Participant
October 19, 2017
Answered

Radio button selected then another checkbox automatically select

  • October 19, 2017
  • 1 reply
  • 1883 views

Hi, in my form one radio button group available. so what i want is, if i select first radio button, another check box should automatically select. if radio button not select then checkbox should empty. pls give javascript to manage this work. i'm using adobe pro xi. thanks in advance. thanks..

This topic has been closed for replies.
Correct answer try67

Sure. Use this code instead:

var rdValue = this.getField("Radio1").valueAsString;

this.getField("CB1").checkThisBox(0, rdValue=="1" || rdValue=="2" || rdValue=="3");

1 reply

try67
Community Expert
Community Expert
October 19, 2017

Let's say the check-box is called "CB1" and you want to tick it when option "1" is selected in the radio-button group "Radio1".

Create a (hidden) text field with this custom calculation script:

this.getField("CB1").checkThisBox(0, this.getField("Radio1").valueAsString=="1");

omanbuxAuthor
Known Participant
October 19, 2017

hi ,thanks a lot & it's working perfectly. i need small changes add to your code. if i select any of first 3 options in radio button group, cehck box should tick. if i select any other options like option 4,5 or 6, check box should untick. is this possible ??. thanks..

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
October 19, 2017

Sure. Use this code instead:

var rdValue = this.getField("Radio1").valueAsString;

this.getField("CB1").checkThisBox(0, rdValue=="1" || rdValue=="2" || rdValue=="3");