Skip to main content
Participant
Jan 22, 2025 6:39 PM UTC
Question

Using a Checkbox to turn a script on or off

I am trying to use a checkbox to turn on and off a discount, I've got the script for the discount to work but I cannot get the checkbox to function.

 

event.value=Number(this.getField("fill_122").valueAsString)*-.1

 

is the script that I have applying the discount, I just need to get my checbox in this case "Con_Check" to turn this discount on and off.

 

Con_Check = checkbox

Fill_122 = field that the discount is being applied to

Contract_Discount = the discount that is being applied

 

Trying to use this to show customers their savings with their contract discount.

2 replies

Thom Parker
Community Expert
Community Expert
Jan 22, 2025 7:06 PM UTC

To be clear, "Fill_122" totals some other values on the form? And this is done with a script?

The "Contract_Discount" field only shows the amount of the discount?

And when the check box is checked the "Fill_122" field shows the (total - discount)?

 

if so then use this code in the calculation script in "Fill_122".

 

even.value = ... total calculation ...

if(this.getField("Con_Check").value != "Off")

    event.value = event.value*.9;

 

Translate
Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
PDF Automation Station
Community Expert
Community Expert
Jan 22, 2025 7:00 PM UTC

What is the location of the script (Calculation?  Validation?  Mouse Up? etc) and in which field?

Translate