Radio button selected then another checkbox automatically select

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

Sure. Use this code instead:

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

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

TOPICS
Acrobat SDK and JavaScript, Windows

Views

1.1K

Likes

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

Radio button selected then another checkbox automatically select

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

Sure. Use this code instead:

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

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

TOPICS
Acrobat SDK and JavaScript, Windows

Views

1.1K

Likes

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
Oct 18, 2017 0
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");

Likes

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
Reply
Loading...
Oct 19, 2017 0
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..

Likes

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
Reply
Loading...
Oct 19, 2017 0
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");

Likes

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
Reply
Loading...
Oct 19, 2017 1
Oct 20, 2017

Copy link to clipboard

Copied

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

Likes

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
Reply
Loading...
Oct 20, 2017 0
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.

Likes

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
Reply
Loading...
Nov 07, 2018 0
try67 LATEST
Nov 07, 2018

Copy link to clipboard

Copied

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

Likes

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
Reply
Loading...
Nov 07, 2018 0