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

How to set so calc. will only take place after value is entered in fld

jyaki
Registered: Sep 30 2008
Posts: 2

It seems like "0" is the default value if nothing is entered in a form field. Unfortunately, some of my calculation scripts are using this default value of "0" and displaying results as soon as the form is opened. Is there any way to set it so "calculation A" will only begin calculating after a value is entered in "form field X"?

Thanks for your help

George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
If you post the script you're currently using we may be able to suggest changes you can make. Are you using Acrobat or LiveCycle Designer to create your form?

George
maxwyss
Registered: Jul 25 2006
Posts: 256
A recommended strategy for PDF forms (not LiveCycle Designer-created) is to do two things:

1. Consolidate the logic into one single script which may be attached either to the last result field of the whole logic, or even to an otherwise unused field

2. After analyzing the conditions of when your calcualtion is actually providing a valid result (meaning that some values must be entered), evaluate those field values and require that they are different from their default value. Only if all fields required for a valid result differ from their default value, you execute the calculation. This may look somehow like this:

var a = this.getField("A") ;
var b = this.getField("B") ;

if (a.value != a.defaultValue && b.value != b.defaultValue) {
// do my calculations
}

This will make your form show valid results (not only correct results).

Hope this can help.

Max Wyss.