Skip to main content
Participant
June 16, 2022
Question

Check Box = a value but only one box in a group can be checked

  • June 16, 2022
  • 3 replies
  • 499 views

Checkboxes - Exceed2, Exceed5, Exceed6

Text Fields - Exceed Count 2, Exceed Count 5, Exceed Count 6

 

I have a column for an employee performance documents with 3 rows of items (Exceed2, Exceed5, Exceed6).  Each row has a checkbox, that if it is checked it will give the corresponding textbox beside it a value of 2.  If unchecked it will be blank.  I have gotten this to work using the custom calculation script.  This is the formula I used.

 

if (this.getField("Exceed2").isBoxChecked(0))
event.value = 2;
else
event.value = "";

 

 

My issue is I only want one of the checkboxes to be able to be checked at a time.  Is this possible?  If not, is it with radio buttons?  

This topic has been closed for replies.

3 replies

ls_rbls
Community Expert
Community Expert
July 3, 2022

++ Adding to the discussion

 

In this scenario, if you want to be able to check one at a time, I would preffer better to use mutually exclusive radio buttons but with the same export value of "2" on each one, and then employ an action script for each of the radio button that corresponds to the desired Exceed2, Exceed5, Exceed6 text fields respectively.

 

 

I would add a script to each radio button as shown below:

// script for the radio butron next to Exceed2 field

if (event.target.value=="Off"){

this.getField("Exceed2").value ="";

} else {

this.getField("Exceed2").value = event.target.value;

this.getField("Exceed5").value = "";

this.getField("Exceed6").value = "";

}

 

 

 

 

 

 

Thom Parker
Community Expert
Community Expert
June 17, 2022

Read this primer on Checkboxes/radiobuttons in Acrobat:

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

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Nesa Nurani
Community Expert
Community Expert
June 17, 2022

It's possible, give all 3 checkboxes same name but give them different export value.