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

Adding fields based on a check box.

LeleyX
Registered: Feb 8 2011
Posts: 6
Answered

I think this might be the last question from the javascrip newbie for a while. The last question is thi: I have some check boxes, and when they are checked I want 3 fields to be added together, otherwise let the result be either null or 0.
Check box: Skill
Fields: Mod, Rank, Misc
so if skill=checked then mod+rank+misc; else 0/null
 
Any help would be appreciated, I tried changing another formula:
 

thomp wrote:

var nSum = 0;
var aCkFlds = this.getField("MyChecks").getArray();
for(var i=0;i<aCkFlds.length;i++)
{ 
   if(aCkFlds[i].isBoxChecked(0))
      nSum++;
}
event.value = nSum;

Thom Parker

 
thomp gave this formula to another user, but I just don't know enough javascript to be able to fix it, if a fix is what's needed rather than a complete different formula.
 
Thank you.

My Product Information:
Acrobat Pro 10.0, Windows
try67
Expert
Registered: Oct 30 2008
Posts: 2398
Accepted Answer
Do you have one check-box (called "Skill"), or multiple ones? If multiple ones, what are their names?

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

LeleyX
Registered: Feb 8 2011
Posts: 6
Please forgive me, but I'll withdraw my question. After talking to some friends, who would be using the form, and it's been agreed to just do those calculations ourselves, it's just 3 numbers, usually single digits. I'm a little bit overly-perfectionalist at times, thank you for thinking about my problem, and apologies for wasting your time.
LeleyX
Registered: Feb 8 2011
Posts: 6
Please forgive me, but I'll withdraw my question. After talking to some friends, who would be using the form, and it's been agreed to just do those calculations ourselves, it's just 3 numbers, usually single digits. I'm a little bit overly-perfectionalist at times, thank you for thinking about my problem, and apologies for wasting your time.