Skip to main content
Kathy409
Participating Frequently
June 17, 2022
Answered

Select all or just one check boxes

  • June 17, 2022
  • 2 replies
  • 1489 views

Hi,

I have a form that says:

Check all that apply

  • Hotel
  • Registration
  • Air Fare
  • Leave with Pay ONLY

Is it possible that if they choose the last one, the others are automatifcally unchecked?

Thanks.

This topic has been closed for replies.
Correct answer Thom Parker

Here's a primer on checkbox/radio buttons in Acrobat forms:

https://www.pdfscripting.com/public/Checkboxes-and-Radio-Buttons.cfm

 

To uncheck all the others, you'll need a mouseUP script on the last checkbox. I'll assume the names of the other checkboxes are the same as the labels.

 

 

if(event.target.value != "Off"){
   this.getField("Hotel").value = "Off";
   this.getField("Registration").value = "Off";
   this.getField("Air Fare").value = "Off";
}

 

That should do it.

 

2 replies

Thom Parker
Community Expert
Thom ParkerCommunity ExpertCorrect answer
Community Expert
June 17, 2022

Here's a primer on checkbox/radio buttons in Acrobat forms:

https://www.pdfscripting.com/public/Checkboxes-and-Radio-Buttons.cfm

 

To uncheck all the others, you'll need a mouseUP script on the last checkbox. I'll assume the names of the other checkboxes are the same as the labels.

 

 

if(event.target.value != "Off"){
   this.getField("Hotel").value = "Off";
   this.getField("Registration").value = "Off";
   this.getField("Air Fare").value = "Off";
}

 

That should do it.

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Participant
June 22, 2022

Thank you! This works just as I needed!

Amal.
Community Manager
Community Manager
June 17, 2022

Hi Kathy

 

Hope you are doing well and sorry for the trouble.

 

The workflow that you are trying to achieve is possible using JavaScript. For more information about using JavaScript, please check the help pages below:

https://helpx.adobe.com/acrobat/using/applying-actions-scripts-pdfs.html

https://acrobatusers.com/tutorials/javascript_console/

 

Hope this information will help

 

Regards

Amal