Copy link to clipboard
Copied
I am trying to create a form to add up only the checked boxes in each column, and then multiply the total by that column number. I am not familar with javascripting, so for column 1, I've used the calculate option in the 1Rating text box properties.
Thanks.
Copy link to clipboard
Copied
So, do the checkboxes in a single line have the same name (i.e. mutually exclusive)? or do they have different names?
What are the export values for the checkboxes in each column?
Have you looked at other posts about adding checkboxes and radiobuttons?
Copy link to clipboard
Copied
Just add column number as export value and it should calculate as if you multiply total.
Copy link to clipboard
Copied
After posting this, I did just that and set each check box with the export value of their column, but I didn't think ahead to some how also limiting each row/question to be able to select only one box, either 1, 2, 3. This method allows them to click all three boxes, which doesn't help, unless I can restrict them to only select one box for each question.
Copy link to clipboard
Copied
That was the point of asking whether the buttons on a single line were mutually exclusive or not. To make them mutually exclusive you'll need to give all the buttons on a single line the same name. You can read more about it here:
https://www.pdfscripting.com/public/Checkboxes-and-Radio-Buttons.cfm
To show the different sums for each column you'll need to use a script that sorts for the different export values. It would help if all of the checkboxes in all rows were prefixed with the same name.
For example "Checkbox.Row1", "Checkbox.Row2", etc.
Then the code could be written like this for column 1:
var nSum = 0;
this.getField("Checkbox").forEach(function(oFld){if(a.valueAsString == "1") nSum+= 1;});
event.value = nSum;
Find more inspiration, events, and resources on the new Adobe Community
Explore Now