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

Radio button selected then another checkbox automatically select

Participant ,
Oct 18, 2017 Oct 18, 2017

Copy link to clipboard

Copied

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..

TOPICS
Acrobat SDK and JavaScript , Windows

Views

1.4K

Translate

Translate

Report

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

correct answers 1 Correct answer

Community Expert , Oct 19, 2017 Oct 19, 2017

Sure. Use this code instead:

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

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

Votes

Translate

Translate
Community Expert ,
Oct 19, 2017 Oct 19, 2017

Copy link to clipboard

Copied

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");

Votes

Translate

Translate

Report

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
Participant ,
Oct 19, 2017 Oct 19, 2017

Copy link to clipboard

Copied

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..

Votes

Translate

Translate

Report

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 ,
Oct 19, 2017 Oct 19, 2017

Copy link to clipboard

Copied

Sure. Use this code instead:

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

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

Votes

Translate

Translate

Report

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
Participant ,
Oct 20, 2017 Oct 20, 2017

Copy link to clipboard

Copied

wow your are the best. thank u very much..

Votes

Translate

Translate

Report

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
LEGEND ,
Nov 07, 2018 Nov 07, 2018

Copy link to clipboard

Copied

I get a js error when I try what it has been explained.

Could you please let me understand it better?

I am using Acrobat DC Pro

On a form I have a group of three radio buttons for choosing e.g.: Tennis, Badmington or Paddel.

And I want on other page of the document, the very same three options appear,but the chosen one is automatically clicked or checked on here too.

What I have tried:

I have the (3) radio buttons group named Radio 1, and then i have created, as explained before, a text field named CB1, and in the Calculate tab I paste the first script, I het nothing but an error. I tried instead a Check Box named CB1 and in Actions tab I paste that first script as add and run a JS. I get a Js error too. Also have tried with three radio buttons (not grouped) and tried your second script with just an option for each and nothing.

Could you please detail how it must be done, Thanks in advance.

Votes

Translate

Translate

Report

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 ,
Nov 07, 2018 Nov 07, 2018

Copy link to clipboard

Copied

LATEST

What does the error message say? What's your code?

Votes

Translate

Translate

Report

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