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

Javascript to show/hide multiple checkboxes with radio buttons

New Here ,
Jul 23, 2024 Jul 23, 2024

Copy link to clipboard

Copied

I'm preparing a fillable form on Acrobat Pro.

I have a radio button group with 3 options.  Each radio button option will show or hide 30-35 check boxes.  Is there a javascript I can add that will do this? 

For a very short example:

Radio Button Choice: "C&I" will HIDE:  "Check Box Cons 1-1", "Check Box Cons 1-2", "Check Box Cons 1-3" , "Check Box Cons 2-1" and SHOW "Check Box Bus 5-1", "Check Box Bus 5-2", "Check Box Bus 5-3"

 

Thanks for any sugguestions!

TOPICS
How to , JavaScript , PDF forms

Views

213

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 , Jul 23, 2024 Jul 23, 2024

Place this script as a Mouse up Action in the concerned radiobutton:

 

if (event.target.value) != "Off") {
	
	for (var i=1; i<4; i++) {
		this.getField("Check Box Cons 1-" + i).display = display.hidden;
		this.getField("Check Box Bus 5-" + i).display = display.visible;
	}
	this.getField("Check Box Cons 2-1").display = display.hidden;
}

else {
	for (var i=1; i<4; i++) {
		this.getField("Check Box Cons 1-" + i).display = display.visible;
		this.getField("Check Box Bus 5-" + i).display = display.h
...

Votes

Translate

Translate
Community Expert ,
Jul 23, 2024 Jul 23, 2024

Copy link to clipboard

Copied

Place this script as a Mouse up Action in the concerned radiobutton:

 

if (event.target.value) != "Off") {
	
	for (var i=1; i<4; i++) {
		this.getField("Check Box Cons 1-" + i).display = display.hidden;
		this.getField("Check Box Bus 5-" + i).display = display.visible;
	}
	this.getField("Check Box Cons 2-1").display = display.hidden;
}

else {
	for (var i=1; i<4; i++) {
		this.getField("Check Box Cons 1-" + i).display = display.visible;
		this.getField("Check Box Bus 5-" + i).display = display.hidden;
	}
	this.getField("Check Box Cons 2-1").display = display.visible;
}

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 ,
Jul 23, 2024 Jul 23, 2024

Copy link to clipboard

Copied

Use the mouse up action of all three radio buttons:

if(event.target.value=="C&I")

{

this.getField("Check Box Cons 1-1").display=display.hidden;

this.getField("Check Box Cons 1-2").display=display.hidden;

this.getField("Check Box Cons 1-3").display=display.hidden;

this.getField("Check Box Cons 2-1").display=display.hidden;

 

this.getField("Check Box Bus 5-1").display=display.visible;

this.getField("Check Box Bus 5-2").display=display.visible;

this.getField("Check Box Bus 5-3").display=display.visible;

}

else

{

this.getField("Check Box Cons 1-1").display=display.visible;

this.getField("Check Box Cons 1-2").display=display.visible;

this.getField("Check Box Cons 1-3").display=display.visible;

this.getField("Check Box Cons 2-1").display=display.visible;

 

this.getField("Check Box Bus 5-1").display=display.hidden;

this.getField("Check Box Bus 5-2").display=display.hidden;

this.getField("Check Box Bus 5-3").display=display.hidden;

}

 

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
New Here ,
Jul 23, 2024 Jul 23, 2024

Copy link to clipboard

Copied

LATEST

YES! Perfect! Thank you so 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