Im new to java scripting but for my role playing group im creating interactive pdf forms for them to use but ive got to a place where im trying to use acrobat X pro to calcute three values. At the moment i can calculate the three values but is there a way i can only get the total value to calculate only if a certain field is filled in. I have fifty fields to do this calculation on but they are set up in exactly the same way so i will use 'VALUE' as a generic term for the different fields

It is not clear what program, Acrobat or LiveCycle Designer, you are using. It is also not clear where you are entering your script.

Please provide more details.

If you are trying to control the execution of a script,then you need to use an 'if' control statement. This statement is supported by Acrobat JavaScript, LiveCycle Designer FormCalc, and LiveCycle Designer JavaScript. It is not supported by Acrobat's simplified field notation nor Acrobat's 'Field is the ___ of the following fields' option.

im using the form editor and within that im going through theproperties screen using the calculate tab of VALUE A the script i used above is not the script im was using it was the easiest way to illustrate what i am trying to achive if i could please have an example script that would be appreciated

The variable "c" will be a string, so I used the unary + operator to convert it to a number, which I also did to the values of the other fields. This ensures numerical addition as opposed to string concatenation if any of the fields are empty.

That last line of code is equivalent to:

if (c) {
event.value = b + +c + d;
} else {
event.value = 0;
}

And that first line of code means: "if the string in the c variable is something other than an empty string..."