Copy link to clipboard
Copied
Hi there sorry for my ignorance I am very new at this
In the attached picture there are 4 columns
Each column has 3 tickboxes
Now I need to teel Acrobat that if any tick is made in Column A it has to add 150 to a field - so if you tick all there in Column A it must still remain 150
The same applies to Column B,C and D
In the end it has to be A+B+C+D= the max value it can be is 150+150+150+150=600
I hope someone can help
Thanks in advance
If your checkboxes are named "A1","A2","A3", same for B,C and D, use this as custom calculation script ot text field where you want to show result:
var t1=0,t2=0,t3=0,t4=0;
for(var i=1; i<=3; i++){
if(this.getField("A"+i).valueAsString != "Off")t1 = 150;
if(this.getField("B"+i).valueAsString != "Off")t2 = 150;
if(this.getField("C"+i).valueAsString != "Off")t3 = 150;
if(this.getField("D"+i).valueAsString != "Off")t4 = 150;}
event.value = t1+t2+t3+t4;
Copy link to clipboard
Copied
Setting a number (150) as export value in checkboxes makes calculations easier.
To be exclusive, checkboxes must have exactly the same name and a different export value.
Fortunately it is possible to use the same number written in 4 different ways as an export value so that the checkboxes remain exclusive, for example :
150
150.0
150.00
150.000
The result (text) field just has to calculate the sum of the checkboxes.
Copy link to clipboard
Copied
Thank you for your response
I did like you said but it tticks the boxes with the same name
Am I doing something wrong?
Copy link to clipboard
Copied
Copy link to clipboard
Copied
If boxes have the same name they WILL have the same value. You must use different names otherwise.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
There are many ways to the same answer. The chances are you will eventually have to work with Javascript: your needs look as if you will eventually have to start programming. However, for now you can try setting the calculation for ATOTAL to be the MAXIMUM of A1,A2,A3 rather than the SUM.
Copy link to clipboard
Copied
If your checkboxes are named "A1","A2","A3", same for B,C and D, use this as custom calculation script ot text field where you want to show result:
var t1=0,t2=0,t3=0,t4=0;
for(var i=1; i<=3; i++){
if(this.getField("A"+i).valueAsString != "Off")t1 = 150;
if(this.getField("B"+i).valueAsString != "Off")t2 = 150;
if(this.getField("C"+i).valueAsString != "Off")t3 = 150;
if(this.getField("D"+i).valueAsString != "Off")t4 = 150;}
event.value = t1+t2+t3+t4;
Copy link to clipboard
Copied