简体   繁体   中英

Adobe Acrobat PDF custom calculation

I kept getting error which is reference not defined. I am entering this script in custom calculation section. Also it kept saying that I am missing semicolon before the statement.

var nPrice = this.getField(sub).value;
var nPrice1 = this.getField(sub1).value;
var nPrice2 = this.getField(sub2).value;

var nDiscount = this.getField(discount).value;

var total = (nPrice + nPrice1 + nPrice2) * nDiscount;

event.value = total;

As it is mentioned already in a comment, the field names must be between quotes. Without quotes, the argument of getField() is expected to be a variable (and if it has not been defined, you have the reference error).

Actually, all the variables could be left away, and instead of that one single (long) line of code could be written.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM