Skip to main content
Participant
April 23, 2025
Question

Check Box Returns Value

  • April 23, 2025
  • 2 replies
  • 344 views

Hello,

Need help! I am new to PDF forms and writing JavaScript.

I have a Checkbox that, when checked I want it to return "2 Weeks" in a Text Box (titled "Lead Time") and when unchecked it will return "8 Weeks" in the same Text Box.

 

Secondly, when that same Checkbox is checked, in another Text Box (titled "ExpediteCost"), a formula will take the Text Box titled "Cost"  and multiply by 10% and show the value in the "ExpediteCost" Text Box.  When the Checkbox is unchecked, the "ExpediteCost" Text Box will be blank or say "N/A".

 

Any help is greatly appreciated!

2 replies

JR Boulay
Community Expert
Community Expert
April 27, 2025

[MOVED TO THE ACROBAT DISCUSSIONS]

Acrobate du PDF, InDesigner et Photoshopographe
try67
Community Expert
Community Expert
April 23, 2025

What's the name of the check-box field?

Participant
April 23, 2025

"ExpediteDrawing"

try67
Community Expert
Community Expert
April 23, 2025

Calc. script for "Lead Time":

 

if (this.getField("ExpediteDrawing").valueAsString=="Off") event.value = "8 Weeks";
else event.value = "2 Weeks";

 

Calc. script for "ExpediteCost":

 

if (this.getField("ExpediteDrawing").valueAsString=="Off") event.value = "";
else event.value = Number(this.getField("Cost").valueAsString) * 0.1;