Skip to main content
Participating Frequently
December 20, 2017
Answered

Checkboxes triggering another checkbox - toggling on/off issues

  • December 20, 2017
  • 1 reply
  • 1495 views

I have series of parent checkboxes that trigger on child checkboxes - copying the value.  But if the user changes the parent checkbox from "On" to "off" the  child checkbox does not copy. This the script i founded was using

var nhnw2 = getField("ClientHNW2").value;

if (nhnw2 === "On")

{

  getField("ClientHNWSup2").value = "On"

} else {

  getField("ClientHNWSup2").value = "Off";

}

JJ

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

Also, this script is inefficient. As long as the parent and child have the same export values then this script will work better:

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

1 reply

Thom Parker
Community Expert
Community Expert
December 20, 2017

Is this script in the MouseUp event for one of the checkboxes?

Does the script work for turning the child On?

Did you change the checkbox export value to "On"?

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Thom Parker
Community Expert
Thom ParkerCommunity ExpertCorrect answer
Community Expert
December 20, 2017

Also, this script is inefficient. As long as the parent and child have the same export values then this script will work better:

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

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Participating Frequently
December 21, 2017

Them Parker

The code you supplied goes in the parent mouse up event?

JJ