I have a javascript that was working in an Acrobat form, but when I bring it over to LC 8.05 it doesn't work any longer. Or should be be in FormCalc here? I need a cost field to calculate and return a value based on the quantity entered. If quantity (ADS3) is 9 or less it multiplies by by the number in ADS1, if more than 9 multiply by ADS2. Any help would be greatly appreciated.
Thanks
// Cost if 1-9
var
v1 = this.getField("ADS1");
// Cost if 10+
var
v2 = this.getField("ADS2");
// Quantity
var
v3 = this.getField("ADS3");
if
(v3.value <= 9)
{
event.value
= v1.value * v3.value;
}
else
{
event.value
= v2.value * v3.value;
}
Views
Replies
Total Likes
That script is using an Acrobat Acroform model. Designer uses a different model (XFA). That script will not work in an XFA form. It needs to be translated. Assuming you keep all of the fieldnames the same it should be something like this (Javascript of course):
if (ADS3.rawValue <= 9) {= ADS1.rawValue * ADS3.rawValue
}
else {= ADS2.rawValue * ADS3.rawValuethis.rawValue
this.rawValue
}
Note: if you have a field called event you shoudl rename it....that name may cause problems as it is a reserved word. You can put this script on the calculate event of the cost field.
Paul