I'm a newbie to LC Designer and I love it. I'm pretty good at designing forms. I just don’t know javascript or formcalc at all! I use the forums and knowledge base which has been a great help. I have two challenges I don’t know how to resolve. I've experimented a lot to no avail.
I have two kinds of assessments/questionnaires in L C Designer 8 that I have created where I need some calculations done. One assessment is using yes or no answers. I need to add up all the no’s and yes’ in a respective totals field. I can use a check box or a radio button whichever is easier in terms of scripting.
The second assessment also has checkboxes. A user has to choose one word from a set. There are 9 words and 45 combinations. For example, Achievement or Recognition; Recognition or Power; Creativity or Service. At the end of the assessment, I have a Totals box for each word and I need to add up all the time the word is selected.
Any help would be so appreciated.
// calculation script for text field
var count = 0;
if(check1.rawValue == 1)
count++;
if(check2.rawValue == 1)
count++;
... etc.
The code could be much shorter and more flexible if the checkboxes are the only fields in a subform, i.e., the subform groups all the checkboxes together. This code is written for a calculation field that's at the same heirarchy level as the subform that contains the checkboxes, named "MyCheckGroup".
var count = 0;
var checkNodes = resolveNodes("MyCheckGroup.*");
for(var i=0;i
Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script