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

trouble using Custom Calculation Scripts

sdwhite
Registered: Nov 3 2010
Posts: 9

I'm pretty new to Acrobat and just as much a novice with javascript but I have a pdf form where I need to have one field display the product of two other fields but only if both of those two fields are filled in; if not, the user needs to be able to enter a number directly into the field.
 
I've tried many variations on the following javascript with no success:
 
var Text11 = this.getField("Text11") ;
var Text12 = this.getField("Text12") ;
var Text13 = this.getField("Text13") ;
 
if (Text11.value != Text11.defaultValue && Text12.value != Text12.defaultValue) {
// do my calculations
}
 
else {$ = Test11.value * Test12.value}
 
endif
 
Any assistance with this would be greatly appreciated!
 
Thanks

My Product Information:
Acrobat Pro 9.0, Windows
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
Are you creating the form in LiveCycle Designer or Acrobat?
sdwhite
Registered: Nov 3 2010
Posts: 9
It was previously created in Acrobat and I'm trying to update it in same.
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
OK, the code should look something like:

var Text11 = getField("Text11") ;
var Text12 = getField("Text12") ;

if (Text11.value !== Text11.defaultValue && Text12.value !== Text12.defaultValue) {// Set this field to result of product of two fields
event.value = Text11.value * Text12.value;

}


This code assumes the fields are numeric.
sdwhite
Registered: Nov 3 2010
Posts: 9
Thanks so much for your help!