Skip to main content
Participating Frequently
January 12, 2024
Answered

PDF Form Checkboxes to select dropdown option

  • January 12, 2024
  • 1 reply
  • 638 views

Hello,  


I am working on a form.  It has 5 checkboxes ( that signify an automatic fail) When I select any of these 5 checkboxes, I want a dropdown to automatically select Fail. 

 

Checkbox names are Yes19 - 23

The Option is 3rd in the menu.  

 

Does someone have any idea how to do this? 

 

Also, I am taking some javascript courses, but do you have nay recommendations for other learning opportunities? 

 

 

This topic has been closed for replies.
Correct answer try67

You can use this code as the custom calculation script of the drop-down:

var fail = false;
for (var i=19; i<=23; i++) {
	if (this.getField("Yes"+i).valueAsString!="Off") {
		fail = true;
		break;
	}
}
if (fail) event.value = "Fail";

General JS tutorial (note that only the core syntax applies to Acrobat): http://www.w3schools.com/js/default.asp

Homepage of the Acrobat SDK, including a link to the full API: http://www.adobe.com/devnet/acrobat.html

Free tutorials about Acrobat in general, including many JS related ones: https://acrobatusers.com/tutorials/

A paid-for website with tutorials about Acrobat JavaScript (not related to me): http://www.pdfscripting.com/

My own humble web-site with many tools for Acrobat and Reader (mostly paid-for, some free): http://www.try67.com

 

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
January 12, 2024

You can use this code as the custom calculation script of the drop-down:

var fail = false;
for (var i=19; i<=23; i++) {
	if (this.getField("Yes"+i).valueAsString!="Off") {
		fail = true;
		break;
	}
}
if (fail) event.value = "Fail";

General JS tutorial (note that only the core syntax applies to Acrobat): http://www.w3schools.com/js/default.asp

Homepage of the Acrobat SDK, including a link to the full API: http://www.adobe.com/devnet/acrobat.html

Free tutorials about Acrobat in general, including many JS related ones: https://acrobatusers.com/tutorials/

A paid-for website with tutorials about Acrobat JavaScript (not related to me): http://www.pdfscripting.com/

My own humble web-site with many tools for Acrobat and Reader (mostly paid-for, some free): http://www.try67.com

 

Rach3ll3gAuthor
Participating Frequently
January 12, 2024

Thank you so much!  I will also take a look at the tutorials you recommend!!