In reference to [url=http://www.acrobatusers.com/forums/aucbb/viewtopic.php?id=14704]this topic[/url], I decided to put together a field that summed up several TotalPrice's in a field called PurchasePrice. I made a brute-force script to experiment, which looks like this:
// clear this field with supressed zero value
event.value = '';
//set up variables
var TPA = this.getField("TotalPriceA");
var TPB = this.getField("TotalPriceB");
var TPC = this.getField("TotalPriceC");
var TPD = this.getField("TotalPriceD");
var TPE = this.getField("TotalPriceE");
var TPF = this.getField("TotalPriceF");
var TPG = this.getField("TotalPriceG");
var TPH = this.getField("TotalPriceH");
var TPI = this.getField("TotalPriceI");
var TPJ = this.getField("TotalPriceJ");
var TPK = this.getField("TotalPriceK");
if (TPA.valueAsString != '' | TPB.valueAsString != '' | TPC.valueAsString != '' | TPD.valueAsString != '' | TPE.valueAsString != '' | TPF.valueAsString != '' | TPG.valueAsString != '' | TPH.valueAsString != '' | TPI.valueAsString != '' | TPJ.valueAsString != '' | TPK.valueAsString != '') {
event.value = Number(TPA) + Number(TPB) + Number(TPC) + Number(TPD) + Number(TPE) + Number(TPF) + Number(TPG) + Number(TPH) + Number(TPI) + Number(TPJ) + Number(TPK);
}
While clumsy, this seems like it should make the PurchasePrice field blank unless any one of the TotalPrice fields A through K are filled, at which point it would be the sum of them. However, I get the error "This value does not match the format of the field [ PurchasePrice ]" when I compile it. This doesn't seem right to me, as the field is formatted as a "Number" field and the event.value is being set to a series of added Number() functions. Is the error trying to tell me something else or is the problem something I misunderstand?
event.value = Number(TPA.value) + Number(TPB.vlaue) + Number(TPC.value )+ Number(TPD.value) + Number(TPE.value) + Number(TPF.value) + Number(TPG.value) + Number(TPH.value) + Number(TPI.value) + Number(TPJ.value) + Number(TPK.value);
George Kaiser