using event.changeEx
I want to modify your example given at
http://acrobatusers.com/tutorials/js_...
for AcroForms
In this example, each part has one price value.
In my calculation, I want relate to each part three values (e.g. price, weight, and length) and show them in the corresponding fields <Price>, <Weight> and <Lenght> in order to use them for further calculations.
The script works perfectly if there is only the field <Price>. But when I extent the array of each Part by the values for "Weight" and "Length" in such way:
var oAssemblyParts = {
Chasis: [
["-","None", "None", "None"], ["Rear Bracket",205.95, 2, 3.2], ["Front Bearing",48.95, 1, 1.75]
]
};
then something goes wrong: All three values are indicated in the part list behind teh part name, the prize field is empty and the fields for weight and length as well.
I think I have to add two more functions similar to the function SetPriceValue()
function SetPriceValue()
{
if(!event.willCommit)
{
var nSelExp = 0;
if(!isNaN(event.changeEx))
nSelExp = event.changeEx
this.getField("Price").value = nSelExp;
}
}
like this
function SetWeightValue()
{
if(!event.willCommit)
{
var nSelExp = 0;
if(!isNaN(event.changeEx))
nSelExp = event.changeEx
this.getField("Weight").value = nSelExp;
}
}
function SetLengthValue()
{
if(!event.willCommit)
{
var nSelExp = 0;
if(!isNaN(event.changeEx))
nSelExp = event.changeEx
this.getField("Length").value = nSelExp;
}
}
But how can I make sure that these functions address the right value of the array, i.e. SetPriceValue() exports the price value, SetWeightValue() exports the weight value and SetLengthValue() exports the value for the length to the fields <Price>, <Weight>, and <Length>, respectively?
Lutz Wittenmayer