Radio buttons disables other checkboxes

New Here ,
Feb 21, 2021 Feb 21, 2021

Copy link to clipboard

Copied

I have four radio buttons in a group. If option one or three are selected I want to disable (and uncheck) a certain checkbox. If option two or four are selected, I want to enable that check box. I'm not sure how to do this.

 

Thanks

 

Jack

 

TOPICS
Edit and convert PDFs , JavaScript , PDF forms

Views

252

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
community guidelines

correct answers 1 Correct answer

Adobe Community Professional , Feb 21, 2021 Feb 21, 2021

You didn't say what are names of the fields or name of radio button options so Il go with default and you change names if you need, This is one of the ways you can do it:

In each radio button -> action tab -> Mouse UP event -> Run a JavaScript add this code:

if(event.target.value == "Choice1" || event.target.value == "Choice3"){
this.getField("Check Box1").value = "Off";
this.getField("Check Box1").readonly = true;}
else if(event.target.value == "Choice2" || event.target.value == "Choice4")
this.g
...

Likes

Translate

Translate
Adobe Community Professional ,
Feb 21, 2021 Feb 21, 2021

Copy link to clipboard

Copied

You didn't say what are names of the fields or name of radio button options so Il go with default and you change names if you need, This is one of the ways you can do it:

In each radio button -> action tab -> Mouse UP event -> Run a JavaScript add this code:

if(event.target.value == "Choice1" || event.target.value == "Choice3"){
this.getField("Check Box1").value = "Off";
this.getField("Check Box1").readonly = true;}
else if(event.target.value == "Choice2" || event.target.value == "Choice4")
this.getField("Check Box1").readonly = false;

Don't forget to change names if needed.

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
community guidelines
New Here ,
Feb 22, 2021 Feb 22, 2021

Copy link to clipboard

Copied

Perfect. Thank you.

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
community guidelines
New Here ,
Apr 07, 2022 Apr 07, 2022

Copy link to clipboard

Copied

LATEST

Hello,

I'm trying to adapt this to something similar. I have two radio buttons "Permanent" and "Temporary". If Permanent is selected, I would like Temporary to be disabled. Likewise, If Temporary is selected, I would like Permanent to be disabled. Can you assist with code for this?!  Thanks for help!

Nikki

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
community guidelines