The following is being used in a form:
I am adding together numbers from a series of text boxes to show a result in a final text box. At times I need to takes one of the text boxes out of the series of text boxes that I am adding. Can I do this either by setting up a check box or clicking a button. How do I do this?
(I haven't included real field code since you didn't specify whether this was for AcroForms or XFA Forms.
var sum = 0;
if(..Check One is on..)
sum += (..Text One Value..);
if(..Check two is on..)
sum += (..Text two Value..);
if(..Check three is on..)
sum += (..Text three Value..);
You could also check for empty field entries. This is a common method, i.e. don't include anything that isn't filled in. The code is similar to the example above except that the field value is tested for a non-numeric value. Use the "NaN()" function.
For example
if( !NaN(.. Field value..))
sum += (..Field value ..);
Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script