These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Help with the following script

excelgeek
Registered: Nov 3 2007
Posts: 44

Hi
I have four exclusive Checkboxs across(vcheckbox) and One Checkbox Down(hcheckbox1). They work fine but when you uncheck VAR T1 is should return the value in c1 to Zero it doesn't. It remains with the last value returned.
This script lives in textsub1. Is there something I can add in the script for a null value in the checkbox for when it is unchecked?

var T1 = this.getField("hcheckbox1")
var T2 = this.getField("vcheckbox");
var c1 = this.getField("textsub1");
{
if
(T2.value == 20 & T1.value == 1)
(c1.value = 1);
else

if
(T2.value == 40 & T1.value == 1)
(c1.value = 2);
else

if
(T2.value == 60 & T1.value == 1)
(c1.value = 3);
else

if
(T2.value == 80 & T1.value == 1)
(c1.value = 4);
}

My Product Information:
Acrobat Pro 8.1.1, Windows
pddesigner
Registered: Jul 9 2006
Posts: 858
This script example does not return the un-checked value to zero but it may achieve the results you want.

If you have a table and the last column or row of data is a calculated field (something like price * qty), the default result is 0.00 until data are added for the fields within the calculation. You can eliminate default zeros in calculated fields with JavaScript.

Example script:

1. var f = this.getField("price.0");
2. var g = this.getField("qty.0");
3. if (g.value !=0)
4. event.value = f.value * g.value;
5. else
6. event.value ="";

In lines 1 and 2 the variables are assigned for a price and quantity field. The result of the calculation is an amount determined by multiplying the price * the quantity.

Line 3 checks the qty field and if it's not zero, the calculation is performed. If the result is zero, line 6 is executed where no value is entered in the field resulting in eliminating default zeros.

My favorite quote - "Success is the ability to go from one failure to another with no loss of enthusiasm.

excelgeek
Registered: Nov 3 2007
Posts: 44
I did something similar to that and it worked with one execption. It doesn't updated until you input something in another field. Is there a script or command that can be placed in the checkbox that will force an update on a mouseup command?