New Here ,
Jul 06, 2022 Jul 06, 2022

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

TOPICS
PDF forms

Views

68

Likes

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Adobe Community Professional , Jul 06, 2022 Jul 06, 2022

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;``````

Likes

8 Replies 8
Jul 06, 2022 Jul 06, 2022

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.

Likes

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
New Here ,
Jul 06, 2022 Jul 06, 2022

Copied

I did like you said but it tticks the boxes with the same name

Am I doing something wrong?

Likes

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
New Here ,
Jul 06, 2022 Jul 06, 2022

Copied

You will notice I cannot select A1 more than once except if I make a manual calculation

Likes

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
LEGEND ,
Jul 06, 2022 Jul 06, 2022

Copied

If boxes have the same name they WILL have the same value. You must use different names otherwise.

Likes

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
New Here ,
Jul 06, 2022 Jul 06, 2022

Copied

I rectified however it stills calculates all of them together

In this instance it is for an entry form where any three columns o A=150 same for the other however it has to be calculated together

Likes

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
LEGEND ,
Jul 06, 2022 Jul 06, 2022

Copied

There are many ways to the same answer. The chances are you will eventually have to work with Javascript&colon; 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.

Likes

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jul 06, 2022 Jul 06, 2022

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;``````

Likes

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
New Here ,
Jul 06, 2022 Jul 06, 2022

Copied

LATEST

Thank you all for the help

This worked perfectly

Likes

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Resources