Skip to main content
May 28, 2020
Answered

Update checkboxes based on the export value of another checkbox

  • May 28, 2020
  • 1 reply
  • 904 views

I hope I titled the subject correctly. I have 4 checkboxes all with the same name ("AccountOwnershipType") and with different export values ("Individual", "Joint", "UTMA", "RepPayee").

 

In the next section, I have 3 checkboxes all with the same name ("Joint1Type") and with different export values ("Joint", "UTMA", "RepPayee").

 

What I am trying to do is this:

If AccountOwnershipType = Joint then Joint1Type = Joint

If AccountOwnershipType = UTMA then Joint1Type = UTMA

If AccountOwnershipType = RepPayee then Joint1Type = RepPayee

 

I cannot simply just reuse the box again as this shows up in another place later in the document that is not so straightforward. If I could figure out how to write the code to make this work it will correlate for me for the part later in the document.

 

I have attempted all sorts of mouseUp scripts and just cannot get it to work. Please help!

 

Thank you!

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

Calculation scripts are run anytime any field on the form is changed, for example, clicking on a checkbox. The code above simply transfers the value from the first checkbox group to the second, anytime any field on the form changes. There are ways to make this more efficient, but if you don't have too many calculations already, it works fine as is. 

1 reply

Thom Parker
Community Expert
Community Expert
May 28, 2020

I would suggest using a Calculation script in a hidden text field to transfer data from one to the other.

 

this.getField("Joint1Type").value = this.getField("AccountOwnershipType").value;

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
May 29, 2020

Thom: how would that correlate to the other checkbox...meaning, if i click the checkbox for AccountOwnershipType for Joint, how does your solution automatically check the box for Joint1Type that is for Joint?

 

Thanks!

Thom Parker
Community Expert
Thom ParkerCommunity ExpertCorrect answer
Community Expert
May 29, 2020

Calculation scripts are run anytime any field on the form is changed, for example, clicking on a checkbox. The code above simply transfers the value from the first checkbox group to the second, anytime any field on the form changes. There are ways to make this more efficient, but if you don't have too many calculations already, it works fine as is. 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often