Copy link to clipboard
Copied
What is the correct custom script for the field suming all checked boxes (Check Box6.1, Check Box 6.2 and Check Box6.3)? Appreciate your help! I tried to read previous posts on total of check boxes but those scripts didn't work.
Give checkboxes export value to be 1. Now use built-in function in text field under 'Calculate' tab select 'value is the' and then pick your checkboxes.
Copy link to clipboard
Copied
Please show your last effort, so we can help you understand what's wrong, and fix it, rather than just write it for you.
Also say what type of action it is (eg mouse down, validate, calculate)
Copy link to clipboard
Copied
Okay, I will try my best to describe what I did. First I created two check boxes ("Check Box6.1" and "Check Box6.2") and I chose 'yes' to export value for both boxes. I chose mouse down under action for each box. Both boxes do not have the calculation option. I then created a text box to function as a total for counting all checked boxes and formated it as number with 0 decimal places . I chose mouse down for this text box ("6 #). This field value isn't validated. I tried to calculate it by having it suming both Check Box6.1 and Check Box6.2, but it didn't work. I believe I need to type a custom script to make it countable. I hope this is clear enough for you to follow?
Copy link to clipboard
Copied
From your description (which is good, but please do include the actual script you write) you are trying to sum something that isn't a number. Check boxes are on or off, but they aren't something you can add up or sum. What you need to do is COUNT the boxes which are checked (by looking at each box in turn to see if it is checked). This will indeed need JavaScript.
Copy link to clipboard
Copied
I found this script from another post, but I wasn't sure how to add "Check Box6.1" and "Check Box6.2" to this script:
var total = 0;
for (var i=1; i<=90; i++) {
if (this.getField("cb"+i).value!="Off") total++;
}
event.value = total;
Copy link to clipboard
Copied
Give checkboxes export value to be 1. Now use built-in function in text field under 'Calculate' tab select 'value is the' and then pick your checkboxes.
Copy link to clipboard
Copied
It finally works! Many thanks for your help!